title: Deleting __MACOSX folder with PHP?
body: <p>Has anyone had any experience with deleting the <code>__MACOSX</code> folder with PHP?</p>
  
  <p>The folder was generated after I unzipped an archive, but I can't seem to do delete it.</p>
  
  <p>The <code>is_dir</code> function returns false on the file, making the recursive delete scripts fail (because inside the archive is the 'temp' files) so the directory isn't empty.</p>
  
  <p>I'm using the built-in ZipArchive class (extractTo method) in PHP5.</p>
  
  <p>The rmdir script I'm using is one I found on php.net:</p>
  
  <pre><code>&lt;?php
  // ensure $dir ends with a slash
  function delTree($dir) {
      $files = glob( $dir . '*', GLOB_MARK );
      foreach( $files as $file ){
          if( substr( $file, -1 ) == '/' )
              delTree( $file );
          else
              unlink( $file );
      }
      rmdir( $dir );
  }
  ?&gt; 
  </code></pre>