Access to the path 'e:\System Volume Information' is denied.

whenrever i am trying from root path of drive i am getting following error

other wise its working fine

Access to the path 'e:\System Volume Information' is denied.

how to solve this problem

foreach (FileInfo fInfoin directory.GetFiles("e:\",SearchOption.AllDirectories))

{

// do some work

}

thanks

[709 byte] By [sri_dotnet] at [2007-12-30]
# 1

As you've found, GetFiles() is pretty unforgiving because it assumes that you’ve got nearly unrestricted read access to all of the files and directories you are trying to access and doesn’t offer an option to override that.

In order to not break down in this manor, you might be better served by writing your own code at a slightly lower level that can handle a single directory failing and still be able to move on unlike DirectoryInfo.GetFiles().

BrendanGrant at 2007-9-5 > top of Msdn Tech,Windows Forms,Windows Forms General...