Zipping folder with absolute path without keeping tree of folders

Posted by Preston on Server Fault See other posts from Server Fault or by Preston
Published on 2012-06-11T20:41:17Z Indexed on 2012/06/11 22:42 UTC
Read the original article Hit count: 237

Filed under:
|
|

I am attempting to use the zip -r command to zip a folder which includes two files. I need to pass the absolute path of the folder with two files (/path/to/my/files/), which is causing all of the folders to be zipped with it, where as I only need the last folder (files/) and its contents to be zipped, so that when the file is unzipped, there is only one folder and the two files within it. How can I modify the command to be able to pass the absolute paths in the arguments while keeping only the last folder?

© Server Fault or respective owner

Related posts about ubuntu

Related posts about command-line