Re: How do I enumerate available drives.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Phillip N Rounds (prounds_at_cassandragroup.com)
Date: 01/13/05


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



Relevant Pages

  • Re: How do I enumerate available drives.
    ... > To enumerate the drives you can use... ... >> I need to eumerate all available drives in a C# Windows Form application ... how to I enumerate all the available drives? ...
    (microsoft.public.dotnet.languages.vc)
  • Enumerating files in an UNC folder in Delphi 5, how ??
    ... I have tried several components available for D5 to enumerate ... UNC-folders which are not mounted as drives on the computer, ... deduce the UNC path from a mounted disk and file, ... program in .NEt technology ?? ...
    (comp.lang.pascal.delphi.misc)
  • RE: How do I enumerate available drives.
    ... To enumerate the drives you can use... ... "Phillip N Rounds" wrote: ... > and then of course the directory tree, ...
    (microsoft.public.dotnet.languages.vc)
  • RE: How do I enumerate available drives.
    ... To enumerate the drives you can use... ... "Phillip N Rounds" wrote: ... > and then of course the directory tree, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • IMAPI Recording
    ... I'm just going through some code I found on MSDN regarding using the IMAPI ... interface. ... Unfortunately all it seems to do is enumerate the drives and ...
    (microsoft.public.vc.language)