title: Recursively create and read directories from zip file using PHP?
body: <p>After doing a lot of searching, I've come up empty on this one. I have a zip file that gets generated by a script. It contains over 100000 images that are stored in different folders. A sample structure looks like this</p>
  
  <pre><code>folder_files/
  -16/
  --1.jpeg
  --2.jpeg
  --3.jpeg
  -15/
  --1.jpeg
  --2.jpeg
  --3.jpeg
  -14/
  ...... and so on till folder 0/
  </code></pre>
  
  <p>I'm unable to replicate this folder structure in a zip file. The first folder "_files/" gets created. But, beyond that it just dumps all the images nested inside the sub folders into the parent. Needless to say the 1.jpg in all the subfolders get overwritten and only 1.jpg ends up existing in the _files/ folder. </p>
  
  <p>To put it in a nutshell, I'm not sure how to create a folder inside a zipfile. That is the problem.</p>
  
  <p>Part 2 of the problem is I'm trying to read this generated zip file using PHP. Ideally, it should detect this parent folder, create it, then enter it, then create the sub folders and its respective children. Basically replicate that zip folder structure into an actual system folder structure. I am at my wit's end about reading data from a folder that exists within a zip file. The examples I've seen only show how to identify a folder and create one in the file system. But, I haven't seen an example that showed me how to enter that folder and get those children out!</p>
  
  <p>Any help would be greatly appreciated!</p>