
First, create an instance of DriveInfo-
DriveInfo dInfo = new DriveInfo("E");
Display available space-
Console.WriteLine("Disk Free space = {0}", dInfo.AvailableFreeSpace);
Now, use the AvailableFreeSpace property and get the percentage of free space-
Double pc = (dInfo.AvailableFreeSpace / (float)dInfo.TotalSize) * 100;
Here you will get the percentage of free size to total disk space -
Console.WriteLine(" Free space (percentage) = {0:0.00}%.", pc);
The above is the detailed content of Find available disk space using C#. For more information, please follow other related articles on the PHP Chinese website!
What platform is 1688?
How to turn off automatic updates in win10
The role of registering a cloud server
Yiou Exchange app official website download address
The difference between server and cloud host
Main class not found or unable to load
What platform is lazada?
Complete collection of SQL query statements