-2

this is the command that actually i want to run using PHP in Linux server. shell_exec(" zip -r abc.doc xyz.doc > foo.zip ");

Using this command i script create damanged zip file, so can anyone help me to make it proper.

Grim...
  • 16,518
  • 7
  • 45
  • 61
user1885136
  • 3
  • 1
  • 2

1 Answers1

1

The syntax is incorrect. Try

zip foo abc.doc xyz.doc

or

zip -r foo abc.dox xyz.doc

depending upon whether you intend to replace the existing archive or not. See man zip for more.

devnull
  • 118,548
  • 33
  • 236
  • 227
  • not creating zip file on your suggested syntax, as my format is given it creates zip file but damaged (not opening or collecting files to compress) – user1885136 Jul 04 '13 at 12:37
  • Yes, but it creates a zip file of **0 bytes** in size. Check! – devnull Jul 04 '13 at 12:40
  • exactly, thats the point that i want to discuss, so any way to create proper formated zip file. – user1885136 Jul 04 '13 at 12:52
  • What else was mentioned in the answer above? – devnull Jul 04 '13 at 12:52
  • devnull yes you are right, "zip foo abc.doc xyz.doc" this command is working properly if we need to zip files, but when we are compressing a folder we use this command = "zip -r archivefile /home/docs/documents" – user1885136 Jul 10 '13 at 07:01