title: ZIP all files in directory and download generated .zip
body: <p>Well, first of all, this is my folder structure:</p>
  
  <pre><code>images/
  
  image1.png
  image11.png
  image111.png
  image223.png
  generate_zip.php
  </code></pre>
  
  <p>And this is mine generate_zip.php:</p>
  
  <pre><code>&lt;?php
  
      $files = array($listfiles);
  
      $zipname = 'adcs.zip';
      $zip = new ZipArchive;
      $zip-&gt;open($zipname, ZipArchive::CREATE);
      foreach ($files as $file) {
        $zip-&gt;addFile($file);
      }
      $zip-&gt;close();
  
      header('Content-Type: application/zip');
      header("Content-Disposition: attachment; filename='adcs.zip'");
      header('Content-Length: ' . filesize($zipname));
      header("Location: adcs.zip");
  
      ?&gt;
  </code></pre>
  
  <p>How to gather all the files from "images/" folder, except "generate_zip.php", and make it a downloadable .zip? In this case the "images/" folder always have a different image. Is that possible?</p>