Hi Friends,
I am working on a Project Called "Computer Scanner", till now i am done with coding in order to scan a Particular Folders and Files.Eventually, i have coded to scan my Hard Drive (C:\\, D:\\) as well so now, When i debug my project in order to scan my computers Hard Drives its giving me an error
"Access to the path 'D:\System Volume Information\' is denied."
So i wants to get rid of this Exception, After studing about this error from internet i got to know that these folders "System volume Information" creates when we create partition in our computers hard drives so it contain some Windows information so i would not be able to delete it. And i tried giving Admin Rights to my code in order to run, but still showing me the same exception.
So plz help me to scan these folders as well,,
Here is the Code.
Thanks in Advance :)
if (folderBrowserDialog1.SelectedPath == "D:\\")
{
//Giving Administration Authentication to the Program
WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent();
WindowsPrincipal currentPrincipal = new WindowsPrincipal(currentIdentity);
if (currentPrincipal.IsInRole(WindowsBuiltInRole.Administrator))
{
//Get all the Folders in Selected Path
List<string> dirListoffoldersinD = Directory.GetDirectories(@folderBrowserDialog1.SelectedPath, "*.*", SearchOption.AllDirectories).ToList();
progressbar1.Maximum = dirListoffoldersinD.Count();