With the help of
DriveInfo class and
GetDrives static property of DriveInfo class,we can achieve.
GetDrives is used to retrieves the drive names of all logical drives.
DriveInfo class comes inside System.IO Namespace.
Dim drive_info() As IO.DriveInfo = IO.DriveInfo.GetDrives
For Each Drv In drive_info
If Drv.IsReady Then
MsgBox(Drv.Name & " " & Drv.AvailableFreeSpace.ToString)
End If
Next
The
IsReady property returns true if the drive is ready otherwise returns false if the drive is not ready.
AvailableFreeSpace property indicates the amount of free space in all the Drives i.e. C:\,D:\ and so on.