I was wondering if there is a way to solve the issue I have with this code:
DriveInfo[] dDrives = DriveInfo.GetDrives();
foreach(DriveInfo dDrive in dDrives)
{
try
{
string sDrive = dDrive.ToString();
string[] sSearch = Directory.GetFiles(sDrive, sFile, SearchOption.AllDirectories);
foreach(string sResult in sSearch)
{
textBox2.Text = sResult + Environment.NewLine;
}
}
catch
{
}
}
When it comes across a file that isn't accessible because of permissions, it will goto the catch and end. What I need it to do is if it comes across a file it can't access, go back to the try block and continue searching. Any help is much appreciated, thanks!