advapi Posted September 4, 2006 Posted September 4, 2006 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 Quote
silvercoin Posted September 11, 2006 Posted September 11, 2006 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.