Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello,

I'm tring to write a simple application that scans hard drive contents to find some files... I'm getting stucked with a particular directory ( C:\System Volume Information).

As soon as I try to do

directory.GetDirectories()

I receive an UnAuthorizedException.

 

Is there a way to check permission before trying to access to the directory?

For now I've got around using try{}catch{} and creating a new FileSystemInfo[] ( I start from FileSystemInfo then I check if it's a dir/file using

is DirectoryInfo/FileInfo

).

 

Am I right or there's a better way?

 

Thanks

Posted

Check Directory Attributes

 

Hi, try checking the attributes of the folders you get in scanning your directories. You can do so by creating instances of DirectoryInfo class for each path that you get. If i remember right, the directory you are trying to access is a system folder. and well, corresponding privileges apply to certain users. you can read on access permissions. MSDN library is an indespensable source for such information.

 

 

 

Thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...