vijay kumar
vijay kumar

Reputation: 377

override all files and folders while unziping except given folder name using php

My file structure in zip is

lib
css
js
app1
app2
index.php

All the above files and folders are in test.zip

i want to extract this test.zip using php

$zip = new ZipArchive;
    $res = $zip->open("test.zip");
    if ($res === TRUE)
        {
            $zip->extractTo('path');
            $zip->close();
        }

if lib folder is already exist in the directory where we are unzipping then except lib(folder) all other files and folders should get override.

how to solve this.

Upvotes: 0

Views: 1348

Answers (1)

Charles Thompson
Charles Thompson

Reputation: 58

http://php.net/manual/en/ziparchive.open.php , on open, pass in the over write flag.

Upvotes: 0

Related Questions