Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi...The title pretty much says what I am trying to do. This is because when I am populating a treeview with all the folders from the system, it is saying that the directory F:\System Volume Information cannot be accessed because it is a system file. It doestn't exactly say the reason but thats what I am thinking. The wierd thing is C# is not having this problem. It is with VB.NET alone.

 

Any ideas?

 

SJ

  • *Experts*
Posted
If you work with the Directory.GetDirectories class or similar then you dont need to worry about checking if its a file or directory.
Posted

Hi Jabe, RIght now, this is how I am trying to check it, but it is returning true for every directory!!

---------------------------------------------------------------------

Private Function IsSystemFile(ByRef dir As DirectoryInfo) As Boolean

If dir.Attributes().System = FileAttributes.System Then

Return True

Else

Return False

End If

End Function

---------------------------------------------------------------------

Please let me know if there is any other way to check that.

 

 

And 'mutant'.....I am using the Directory.GetDirectories class to get the list of directories. This is what it is saying when I run the application:

--------------------------------------------------------------------------

Access to path f:\\System Volume Information is denied

--------------------------------------------------------------------------

I am not getting this message for the C and D drives which are being checked before the F-drive according to my algorithm.

Any ideas??

 

Hi 'PlausiblyDamp'...I understand that it is the permission problem. But when we r running this application on the web, we cant possibly do anything about the permissions of the user's system directories..istn't it???

 

Thanks for your time guys......

 

SJ

Posted

sj1187534,

 

I don't have VS.NET handy right now but this is worth a shot:

 

Private Function IsSystemFile(ByRef dir As DirectoryInfo) As Boolean
Return (dir.Attributes And FileAttributes.System) > 0
End Function

Posted

Hi Jade...What you said worked on my system without any problem. Now, I have a new problem. The same project is returning the same error for a different folder in a different system. Is this problem system specific??? I heard that if we use DirectoryInfo.GetDirectories() should not worry about this. I am using the same but I dont know why I am getting this error.

 

The new error is showing that access is denied to C:\\Config.msi.

 

Ideas?

 

SJ

  • *Experts*
Posted

Sounds like the security features of Windows are kicking in... is this an NTFS partition?

 

I think the best way to do it is to simply place your code inside a Try....Catch block and bypass the error.

Try
 'do your check here
Catch e As Exception
 System.Diagnostics.Debug.WriteLine("Error encountered: " & e.Message)
End Try

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...