sj1187534 Posted July 1, 2003 Posted July 1, 2003 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 Quote
JABE Posted July 1, 2003 Posted July 1, 2003 Check the Attribute property of DirectoryInfo and FileInfo class if the System bit is turned on. Quote
*Experts* mutant Posted July 1, 2003 *Experts* Posted July 1, 2003 If you work with the Directory.GetDirectories class or similar then you dont need to worry about checking if its a file or directory. Quote
Administrators PlausiblyDamp Posted July 1, 2003 Administrators Posted July 1, 2003 It could also be a permission problem, IIRC then the \System Volume Information folder has very restrictive permissions applied. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
sj1187534 Posted July 1, 2003 Author Posted July 1, 2003 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 Quote
JABE Posted July 1, 2003 Posted July 1, 2003 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 Quote
sj1187534 Posted July 1, 2003 Author Posted July 1, 2003 Hey Jabe...That worked great....thanks a lot man..... SJ Quote
sj1187534 Posted July 1, 2003 Author Posted July 1, 2003 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 Quote
*Experts* Volte Posted July 1, 2003 *Experts* Posted July 1, 2003 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 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.