title: Delete Directories with files under 5MB
body: <p>I would like to delete all directories under a starting directory that do not contain any files larger than 5MB.</p>
  
  <p>My first thought was to delete all files less than 5MB in one command, then delete all empty directories, but that will not work. If a directory contains a file greater than 5MB, I want to keep all files within the directory and not delete the directory.</p>
  
  <p>Ideally, the folders directly under the starting point would never be deleted even if they are empty (John and Michael in the example below).</p>
  
  <p>Given <code>c:\Media</code> as the starting point:</p>
  
  <pre><code>c:\Media\
     John\  --this directory should not be deleted because Dir 3 remains
        Directory 1\  --this directory and all its files should be deleted
           small-file.1.txt [2kb]
           small-file.2.txt [7kb]
        Directory 2\  --this directory and everything below should be deleted
           Subdirectory 1\
              small-file-3.txt [1kb]
        Directory 3\ --this directory should NOT be deleted
           large-file-1.txt [6mb]  -- should not be deleted
           small-file-4.txt [8kb]  -- should not be deleted
     Michael\
        Directory 4\  -- should be deleted
           small-file-5.txt [12kb]  
           small-file-2.txt [12kb]
  </code></pre>
  
  <p>After the PowerShell script runs, I would like the directory structure to look like:</p>
  
  <pre><code>c:\Media\
     John\
        Directory 3\
           large-file-1.txt [6mb]  -- should not be deleted
           small-file-4.txt [8kb]  -- should not be deleted
     Michael\
  </code></pre>
  
  <p>If the <code>Michael</code> folder ends up deleted, that wouldn't be the end of the world.</p>