title: How to read all files from a zip file
body: <p>I'd like to recursively read a zip file and then extract all files in a separate folder. </p>
  
  <p>For example if <code>some.zip</code> file has the following contents:</p>
  
  <pre><code>file5.txt
  somefolder
    file.txt
    file4.txt
  inside.zip 
    file2.txt
    file3.txt
  </code></pre>
  
  <p>What I want is just all the files, including all the files in zip files inside the zip file (<code>inside.zip</code> in the example above). </p>
  
  <p>end result of <code>somefolder</code> would be all the files (I don't care about the folder structure):</p>
  
  <pre><code>file5.txt
  file.txt
  file4.txt
  file2.txt
  file3.txt
  </code></pre>
  
  <p><strong>What I tried:</strong></p>
  
  <p>I have the code below but it maintains the folder structure and does not open zip files inside zip files: </p>
  
  <pre><code>import java.util.zip.*
  def extractZip (String zipFile) {
      def zipIn = new File(zipFile)
      def zip = new ZipFile(zipIn)
  
      zip.entries().findAll { !it.directory }.each { e -&gt;
          (e.name as File).with{ f -&gt;
              f.parentFile?.mkdirs()
              f.withOutputStream { w -&gt;
                  w &lt;&lt; zip.getInputStream(e)
              }
          }
      }
  }
  </code></pre>