0

I have zip file like this

my.zip
    hello.json
    map
      test.png
      b.obj

use following code to extract

$zip = new ZipArchive;
$res = $zip->open('my.zip');
if ($res === TRUE) {
    $zip->extractTo('/my/destination/dir/');
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}

It will create directory like this

/my/destination/dir/
     my
         hello.json
         map
            test.png
            b.obj

I'd like to get this result

/my/destination/dir/
         hello.json
         map
            test.png
            b.obj

how to do this in php?

Vidy Videni
  • 1,897
  • 3
  • 15
  • 23

0 Answers0