title: How fast is RecursiveDirectoryIterator and Zip Archive?
body: <p>So I wanna zip a folder using RecursiveDirectoryIterator, how fast can it zip up a very complicated directory, with all the files combined together not more than 600 MB of size?</p>
  
  <p>This is the code am using:</p>
  
  <pre><code>$mainFolder=basename($routeFolder);
  if(!file_exists('../zips'))
      mkdir('../zips', 0744);
  
  $zip = new ZipArchive;
  $firstres=$zip-&gt;open($zipName, ZipArchive::OVERWRITE);
  
  $files = new RecursiveIteratorIterator(
      new RecursiveDirectoryIterator($routeFolder),
      RecursiveIteratorIterator::SELF_FIRST
  );
  
  foreach ($files as $name =&gt; $file) {
  
      if(is_file($file) &amp;&amp; file_exists($file)){
          $new_filename = substr($file, strpos($file, $mainFolder));
          $zip-&gt;addFile($file,$new_filename);
      }
  }
  
  $zip-&gt;close();
  </code></pre>
  
  <p>So, approximately, how long is it gonna take to zip up a very complex directory? Is it gonna face any memory issue? Anyway, am using ajax, so it wont lead to browser crashing or browser page becoming unresponsive...but still how long is it gonna take?</p>