The -x
option is a bit strange; you list the files, starting with -x
, and ending with an @
sign:
zip file.zip -r * -x dir1 dir2 file1 file2 @
I also seriously doubt you want \
in your filenames on a Unix system … make sure your paths are OK. /
is the usual path separator.
Example:
mkdir tmp5
cd tmp5
touch a b c d e f g
zip foo.zip -r * -x e f g @
adding: a (stored 0%)
adding: b (stored 0%)
adding: c (stored 0%)
adding: d (stored 0%)
With subdirectories, you can easily omit their contents using a wildcard, but it seems that the *
causes the directory itself to be included (empty):
mkdir x y z
touch {a,b,c} {x,y,z}/{a,b,c}
zip foo.zip -r * -x c y y/* z z/* @
adding: a (stored 0%)
adding: b (stored 0%)
adding: x/ (stored 0%)
adding: x/b (stored 0%)
adding: x/a (stored 0%)
adding: x/c (stored 0%)
adding: y/ (stored 0%)
adding: z/ (stored 0%)
You might to better to omit the *
and explicitly list those things you do want included…
zip core-latest-$version.zip -r cp images include mobile stats \
-x cp/includes/configure.php @
(the \
at the end just continues to the next line; you can put it all on one line without the trailing \
)