i tried to recursive all files in logical drive. i getting exception. how to exactly solve this? what the best to handle exception?
using System;
using System.IO;
using System.Threading;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var list = Directory.EnumerateFiles(@"c:\", "*", SearchOption.AllDirectories);
try
{
if ((File.GetAttributes(@"c:\") & FileAttributes.ReparsePoint)
!= FileAttributes.ReparsePoint)
{
foreach (string dir in list)
{
Console.WriteLine(dir);
Thread.Sleep(10);
}
}
}
catch (UnauthorizedAccessException e) { Console.WriteLine(e); Console.ReadLine(); }
}
}
}