System.IO.DriveInfo.GetDrives
Private Sub DriverLister
 Dim sdx As String
 Dim gd() As System.IO.DriveInfo
 gd = DriveInfo.GetDrives
 ' iterate through each drive
 For Each d In gd
 ' check if its ready so that all info is available
   If d.IsReady Then
    sdx = String.Format("{0,9} drive format {1,-12} drive type {2:-15} Total free space {3,15:D}", 
                                  d.Name, d.DriveFormat, d.DriveType.ToString, d.TotalFreeSpace)
    Console.WriteLine(sdx)
   Else
    ' else not ready still can access the name and drive type
    sdx = String.Format("{0,9} drive type {1,-12} {2,-15} ", d.Name, d.DriveType.ToString, "Not ready")
    Console.WriteLine(sdx)
   End If
 Next
End Sub

 
Output:

 C:\ drive format NTFS         drive type Fixed Total free space    879009660928
 D:\ drive format NTFS         drive type Fixed Total free space      2400251904
 E:\ drive type CDRom        Not ready       
 F:\ drive type Removable    Not ready       
 N:\ drive format FAT          drive type Network Total free space    879009660928
Although I did not access it in this program, VolumeLabel is also provided by DriveInfo.GetDrives.

A disk type of Ram Disk would be reported as "Ram", if the disk type is not known then what else but "Unknown".



































































































600

1200

1800

2400

3000

3600

4200

4800

5400

6000

6600

7200

7800

8400

9000

9600

10200

10800

11400

12000

12600

13200

13800

14400

15000

15600

16200

16800

17400

18000

18600

19200

19800

20400

11/25/2015
TheLonelyProgrammer.Net
Alone in a sea of non-programmers
Home File Copy Path List Drives List Files Special Folders Accessing and changing file times