Create zip file and ignore directory structure Create zip file and ignore directory structure linux linux

Create zip file and ignore directory structure


You can use -j.

-j--junk-paths          Store just the name of a saved file (junk the path), and do  not          store  directory names. By default, zip will store the full path          (relative to the current directory).


Using -j won't work along with the -r option.
So the work-around for it can be this:

cd path/to/parent/dir/;zip -r complete/path/to/name.zip ./* ;cd -;

Or in-line version

cd path/to/parent/dir/ && zip -r complete/path/to/name.zip ./* && cd -

you can direct the output to /dev/null if you don't want the cd - output to appear on screen


Use the -j option:

   -j     Store  just the name of a saved file (junk the path), and do not          store directory names. By default, zip will store the full  path          (relative to the current path).