Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

  • Leaders
Posted

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.

[sIGPIC]e[/sIGPIC]
Posted

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.

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