No System Directories

usvpn

Freshman
Joined
Apr 19, 2010
Messages
45
Hi,
I get the directories like this:
Visual Basic:
Dim DriveInfo As New DirectoryInfo("C:\")
Dim DirInfo As DirectoryInfo() = DriveInfo.GetDirectories
However, it returns all directories even system hidden ones.
It seems that this just follows what I set in Windows for file and folder browsing, since I set the Windows to show all files, I think it's also showing all folders to me, I am not sure however.
I just want NOT to get the system directories like Recycle Bin and System Volume Information, how to do that?
Thank you.
 
I would imagine that it would always return all directories. A user's preferences for Explorer shouldn't affect the way file I/O works in .NET.

What you need to do is examine the Attributes property of the DirectoryInfo object, and just filter out those directories that you don't want.
 
Just a general question:
I prevent user from getting System directories so he cannot select them.
But aside System directories, what other directories I should prevent from listing?
For example, my application runs as Invoker, of course!
Now if a directory has denied user from accessing (Properties/Security Tab in Windows 7) that directory also must not be listed.
 
Back
Top