How do you use DriveInfo
to get information about available drives and their free space?
home / developersection / forums / how do you use driveinfo to get information about available drives and their free space?
How do you use DriveInfo
to get information about available drives and their free space?
Anubhav Kumar
22-May-2025You can use the
System.IO.DriveInfo
class in C# to get information about available drives and their properties such as name, type, format, total size, and free space.Example: List All Drives and Their Free Space
🔍 Output Sample (Windows)
Useful Properties of
DriveInfo
Name
C:\
)DriveType
IsReady
VolumeLabel
DriveFormat
AvailableFreeSpace
TotalFreeSpace
TotalSize