Command to zip a directory using a specific directory as the root

Posted by Slokun on Stack Overflow See other posts from Stack Overflow or by Slokun
Published on 2010-03-18T20:23:25Z Indexed on 2010/03/18 21:41 UTC
Read the original article Hit count: 335

Filed under:
|
|
|

I'm writing a PHP script that downloads a series of generated files (using wget) into a directory, and then zips then up, using the zip command.

The downloads work perfectly, and the zipping mostly works. I run the command:

zip -r /var/www/oraviewer/rgn_download/download/fcst_20100318_0319.zip /var/www/oraviewer/rgn_download/download/fcst_20100318_0319

which yields a zip file with all the downloaded files, but it contains the full /var/www/oraviewer/rgn_download/download/ directories, before reaching the fcst_20100318_0319/ directory.

I'm probably just missing a flag, or something small, from the zip command, but how do I get it to use fcst_20100318_0319/ as the root directory?

© Stack Overflow or respective owner

Related posts about linux

Related posts about zip