Link to home
Start Free TrialLog in
Avatar of FRIBBLE1
FRIBBLE1

asked on

Trubble with System.IO.Directory.GetLogicalDrives.GetType

I'm trying to find out what type of each drive is then remove the ones which arnt hard drives.

The GetLogicalDrives works fine but how do i then uses this incomation in the Get type method.

drives = System.IO.Directory.GetLogicalDrives
System.IO.Directory.GetLogicalDrives.GetType()

Thanks for your help
Avatar of iboutchkine
iboutchkine

that is how you can get the drive type

Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA"
(ByVal nDrive As String) As Int32

Dim s As String
  Dim drivers() As String = Directory.GetLogicalDrives
  For Each s In drivers
   If GetDriveType(s) = 5 Then
    Console.WriteLine("drive letter {0} is a CDROM", s)
   End If
Next
ASKER CERTIFIED SOLUTION
Avatar of toddhd
toddhd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oops, too slow on the draw :)
Avatar of FRIBBLE1

ASKER

Thanks very much
FWIW, stick with iboutchkine's suggestion, or some version of that anyway. This blog (http://blogs.vbcity.com/drydo/) shows that it is faster than the one I posted :)