So I've done extensive research on this and I've realized that GetDirectories
will stop returning folders at the point it gets an UnauthorizedAccessException
even if you have a try...catch
block.
try
{
foreach (DirectoryInfo directory in parent)
{
subDirectories = directory.GetDirectories();
}
}
catch (Exception e) { }
All the sub-directories will get into sub-directories until we hit the exception and then stop. Are there any solutions to this for my specific code? Thanks!