title: PHP: How to delete all subfolders (only 1MB or smaller in size) and wipe out all its files?
body: <p>I need to put condition only delete all folders that have 1mb and smaller in size.</p>
  <pre><code>$dir =&quot;thousandfolders&quot;;
  
     function del($dir) { 
        foreach(glob($dir . '/*') as $file) 
        { 
          if(is_dir($file))
              del($file); 
        } 
        rmdir($dir); 
      }
  </code></pre>