title: how to find the amount of space in a directory or the partition directory is in
body: <p>I want to write a script that fills a directory with music until there's a certain amount of space left. The directory may be on various partitions and I don't know how to ask a directory for free space or it's partition.</p>
  
  <pre><code>pseudocode
  fill(directory)
    until &lt; 100 mb of free space in directory
      copy music to directory
  </code></pre>
  
  <p>How would you do it using unix tools like bash, find, etc.</p>