Re: How do I enumerate available drives.
From: Phillip N Rounds (prounds_at_cassandragroup.com)
Date: 01/13/05
- Next message: Herfried K. Wagner [MVP]: "Re: How to translate 'Ctrl' to "Strg' for German localization?"
- Previous message: José Araujo: ""Object type cannot be converted to target type" / Inheriting forms"
- In reply to: Ssmoimo: "RE: How do I enumerate available drives."
- Next in thread: Herfried K. Wagner [MVP]: "Re: How do I enumerate available drives."
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 13 Jan 2005 11:02:13 -0500
Thanks
"Ssmoimo" <Ssmoimo@discussions.microsoft.com> wrote in message
news:0E99738F-15B4-40D0-94D0-263BEF9F20F1@microsoft.com...
> Hi Phillip,
>
> To enumerate the drives you can use...
>
> System.IO.Directory.GetLogicalDrives();
>
> John
>
> "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: Herfried K. Wagner [MVP]: "Re: How to translate 'Ctrl' to "Strg' for German localization?"
- Previous message: José Araujo: ""Object type cannot be converted to target type" / Inheriting forms"
- In reply to: Ssmoimo: "RE: How do I enumerate available drives."
- Next in thread: Herfried K. Wagner [MVP]: "Re: How do I enumerate available drives."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|