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" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php