PHP ZipArchive list archive contents
I have wp.zip and would like to list only one level of files/folders. My current code:
$zip = new \ZipArchive();
$zip->open('wp.zip'), \ZipArchive::RDONLY);
for ($i = 0; $i < $zip->numFiles; $i++) {
$stat = $zip->statIndex($i);
echo $stat['name'] . ' ';
}
This code spits out entire list of files recursively.
I need only first level, like this:
wp-admin/
wp-content/
index.php
config.php
<...>
What's the best approach to achieve my goal?
Tagged:
Comments
Shit, NVM. Seems Zip has no levels. I will just parse the damn list and format it.
Another ticket resolved by our helpful LESbians.
Here is solution:
BOOM goes the dynamite.