guny guny - 3 years ago 161
PHP Question

How to rename a folder using ZipArchive?

is there any solution to rename a folder inside zipfile before unzipping ?

$zip = new ZipArchive();
$result=$zip->renameName($acfoldername , $renameFolder );

Function renameName seems only to rename files and not folders

$zip->renameName($acfoldername , $renameFolder );

is there any solution in Zend Framework for zip file management?

Answer Source

Sorry , but there is no class in the ZF that able to rename folder inside of the ZIP file

but again there is nothing impossible you can use the same ZipArchive to extract the file somewhere and then using the function Glob or SPL Directory Iterator "

to locate your wanted folder using rename and the last step is to zip your folder again using the same ZipArchive

example of creating zip file :

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download