Search code examples
phpzend-frameworkunzip

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 );

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


Solution

  • 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 : http://davidwalsh.name/create-zip-php