How to bypass/ignore "Access to the path is denied"/UnauthorizedAccess exception
and continue to collecting filenames in this method;
public static string[] GetFilesAndFoldersCMethod(string path)
{
string[] filenames = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Select(Path.GetFullPath).ToArray();
return filenames;
}
页: 1 ......
foreach (var s in GetFilesAndFoldersCMethod(@"C:/"))
{
Console.WriteLine(s);
}
My application stops on the firstline of GetFilesAndFoldersCMethod and an exception says; "Access to the path C:@Logs is denied.". Please help me...
Thanks,