i’m trying to use this ssh command in centos 5 to zip up a directory full up folders and files yet exclude the examples below. it’s not working.
zip -r file.zip * -x dir1 -x dir2 -x file1 -x file2
or this one
zip -r file.zip * -x "dir1" -x "dir2" -x "file1" -x "file2"
It still just zips up the whole directory and everything it in. I don’t want dir1 dir2 file1 file2.
I need to know the right -x syntax for the exclude functions to work.
The
-xoption is a bit strange; you list the files, starting with-x, and ending with an@sign: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:
With subdirectories, you can easily omit their contents using a wildcard, but it seems that the
*causes the directory itself to be included (empty):You might to better to omit the
*and explicitly list those things you do want included…(the
\at the end just continues to the next line; you can put it all on one line without the trailing\)