RE: How do I enumerate available drives.
From: Ssmoimo (Ssmoimo_at_discussions.microsoft.com)
Date: 01/12/05
- Next message: Ssmoimo: "RE: How do I enumerate available drives."
- Previous message: Phillip N Rounds: "How do I enumerate available drives."
- In reply to: Phillip N Rounds: "How do I enumerate available drives."
- Next in thread: Ssmoimo: "RE: How do I enumerate available drives."
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 12 Jan 2005 15:37:04 -0800
"Phillip N Rounds" wrote:
> I need to eumerate all available drives in a C# Windows Form application (
> and then of course the directory tree, but that's not the problem)
>
> My question is, how to I enumerate all the available drives?
> My initial thought was along the lines of
>
> DirectoryInfo di = new DirectoryInfo( "c:\\");
> DirectoryInfo Root = new DirectoryInfo( di.Parent.Name.ToString() );
> DirectoryInfo[] RootDrives = Root.GetDirectories();
>
> This, of course, doesn't work as the parent of c:\ is null.
>
> For my immediate needs, I could simply loop through a:\, b:\, c:\... z:\,
> test to see if the new DirectoryInfo("x:\\") threw an error, and be
> satisfied with that.
> This seems, at least, to be crude. I also would like the ability to get UNC
> shares.
>
> Anyone have a solution?
>
> Thanks
> Phil
>
>
>
- Next message: Ssmoimo: "RE: How do I enumerate available drives."
- Previous message: Phillip N Rounds: "How do I enumerate available drives."
- In reply to: Phillip N Rounds: "How do I enumerate available drives."
- Next in thread: Ssmoimo: "RE: How do I enumerate available drives."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|