Directory.EnumerateFiles => UnauthorizedAccessException
I Couldn’t get the above to work, but here is my implementation, i’ve tested it on c:\users on a “Win7” box, because if has all these “nasty” dirs: SafeWalk.EnumerateFiles(@”C:\users”, “*.jpg”, SearchOption.AllDirectories).Take(10) Class: public static class SafeWalk { public static IEnumerable<string> EnumerateFiles(string path, string searchPattern, SearchOption searchOpt) { try { var dirFiles = Enumerable.Empty<string>(); if(searchOpt == … Read more