title: Finding available space for a directory in C# on Linux
body: <p>I need code that can both compile under Visual Studio &amp; Mono, &amp; run on Linux or Windows.</p>
  
  <p>I need to return the free space available given only the path to the directory.</p>
  
  <p>On windows I'd do something along the lines of -</p>
  
  <pre><code>var file  = new FileInfo(path);
  var drive = new DriveInfo(file.Directory.Root.FullName);
  return drive.AvailableFreeSpace;
  </code></pre>
  
  <p>However on Linux this seems to throw an Argument Exception. file.Directory.Root.FullName returns '/'. DriveInfo throws an Argument Exception of 'The drive name does not exist'</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks</p>