usvpn Posted October 25, 2010 Posted October 25, 2010 Hi, I get the directories like this: 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. Quote
Leaders snarfblam Posted October 25, 2010 Leaders Posted October 25, 2010 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. Quote [sIGPIC]e[/sIGPIC]
usvpn Posted October 26, 2010 Author Posted October 26, 2010 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. Quote
Leaders snarfblam Posted October 26, 2010 Leaders Posted October 26, 2010 Well, a quick google search gave me this discussion on examining a folder's permissions. Quote [sIGPIC]e[/sIGPIC]
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.