Skip to content

Instantly share code, notes, and snippets.

@martinbowling
Created January 25, 2011 00:45
Show Gist options
  • Save martinbowling/794306 to your computer and use it in GitHub Desktop.
Save martinbowling/794306 to your computer and use it in GitHub Desktop.
Does Drive Have Free Space?
public bool hasFreeSpace()
{
System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();
foreach (System.IO.DriveInfo drive in drives) {
if (drive.Name.ToString() == "/")
{
if (drive.IsReady) {
Console.WriteLine(drive.AvailableFreeSpace);
if (drive.AvailableFreeSpace > 1000)
return true;
else
return false;
}
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment