I am trying to create a .zip file of a folder in linux.
First I go where the compressed folder is:
shell_exec('cd /var/www/vhosts/website/test/');
The folder test has the folder testzip which should be zipped and sent somewhere else:
shell_exec('zip a -r -tzip /var/www/vhosts/website/zip/save/testzip.zip /var/www/vhosts/website/test/testzip');
This should create testzip.zip
. Somehow this doesn’t work.
Could anyone help?
Advertisement
Answer
Try with
"zip -a -r ..."
instead of
"zip a -r ..."
— EDIT —
Reading the comment of Mark Adler, I realized that you’re using zip
with 7-zip parameters.
So… are you sure that your zip
is a link to 7z
?
Anyhow, I suggest you to avoid ambiguities: is your intention is use 7z
, explicit it with
"7z a -r -tzip ..."
If you want call the zip
executable, use a correct zip
syntax.
p.s.: sorry for my bad English