Re: Create a zip archive from a folder

From: Date: Thu, 29 Jan 2004 10:36:48 +0000
Subject: Re: Create a zip archive from a folder
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176176@lists.php.net to get a copy of this message
I have achieved this using the shell_exec() function: $cmd = "cd ".escapeshellarg($curdir).";zip -r9b . ".escapeshellarg($name)." *"; $result = shell_exec($cmd); This moved the shell into the current directory ($curdir), then creates a new zip file ($name) for the entire directory. I have noticed that shell_exec() has unexpected results with certain commands, i.e. if it fails you won't always get the same message that you'd get at the command prompt. "Matt Palermo" <webmaster@sweetphp.com> wrote in message news:20040129095002.6021.qmail@pb1.pair.com... > Hello. Does anyone know how I can easily create a zip archive from a folder > on my server? I have a library class that will do this for a tar file (I > just give it the folder name and the archive name and it creates the tar > file for me very easily). I was wondering if there is anything really easy > like this for creating zip files. Please let me know. > > Thanks, > > Matt > http://sweetphp.com/

« previous php.general (#176176) next »