How to add files and dirs to a zip file without the root dir?
command-line, zip
Solution
I understand that you do not want to `cd`, but...
If all else fails and you are hoping to keep your call to zip down to one line, you could chain the calls and use a relative path to output zip in the root:
For Windows:
`cd base & zip -r ..\out.zip * & cd ..`
For Linux/Unix:
`cd base ; zip -r ../out.zip * ; cd ..`
Problem
The zip utility program, when invoked as `zip -r out.zip base/*` on this directory structure ``` . ./base ./base/b ./base/b/c ./base/d ``` creates the following result ``` adding: base/b/ (stored 0%) adding: base/b/c (stored 0%) adding: base/d (stored 0%) ``` I would like to obtain a file containing data as from the following output ``` adding: b/ (stored 0%) adding: b/c (stored 0%) adding: d (stored 0%) ``` I expected the -j option to help me, but it does not: it completely flattens the directory structure. At the moment, the only solution I found is to cd into base and invoke zip from here, but I was wondering if there's a powerswitch I fail to recognize as such in the docs.