Iterate A drive In .net

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi,

I have been working on a function to iterate through folders and build a
tree using recurion.
This works well enough, However I am having trouble working out how to
iterate

1. A drive (for example my C:// drive)

2. A UNC path

for example I can iterate a dir using the following syntax, however I am
unable to locate similar syntax for
either of the two options above.

For Each odir In dir.GetDirectories

Next

If anybody knows of code to do this (iterate drives and UNC paths) I would
appreciate some advice.

any help or pointers to articles of interest is appreciated.

many thanks in advance.

martin.
 
You are probably not using DirectoryInfo class properly. See this on MSDN:
msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemIODirectoryInfoClassTopic.asp

DirectoryInfo di = new DirectoryInfo("A:\\"); // this should work fine
 
Hi,

I'm sorry, I actually was using it properly, however the first folder on
that drive did not grant permission to the account that was iterating it.

cheers

martin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top