How to zip a whole folder using PHP

前端 未结 15 2281
有刺的猬
有刺的猬 2020-11-22 08:48

I have found here at stackoveflow some codes on how to ZIP a specific file, but how about a specific folder?

Folder/
  index.html
  picture.jpg
  important.tx         


        
15条回答
  •  花落未央
    2020-11-22 09:04

    Why not Try EFS PhP-ZiP MultiVolume Script ... I zipped and transferred hundreds of gigs and millions of files ... ssh is needed to effectively create archives.

    But i belive that resulting files can be used with exec directly from php:

    exec('zip -r backup-2013-03-30_0 . -i@backup-2013-03-30_0.txt');
    

    I do not know if it works. I have not tried ...

    "the secret" is that the execution time for archiving should not exceed the time allowed for execution of PHP code.

提交回复
热议问题