This will give you the free space percentage:
Console.WriteLine(GetFreePercentage(@"C:\"));
...
private double GetFreePercentage(string driveName)
{
foreach (DriveInfo drive in DriveInfo.GetDrives())
{
if (drive.IsReady && drive.Name == driveName)
{
return ((double)drive.AvailableFreeSpace / (double)drive.TotalSize) * 100;
}
}
return -1.0;
}
All you have to do is call it when you need to know...