opensuse v11.2, linux 2.6.31.12-0.1-desktop x86_64
ZIP v2.32
I thought I knew ZIP pretty well. Hah!
I wish to exclude some files from a zip archive. On other OSes to exclude an entire directory I would use the “-x” option like so:
zip -r archive-name * -x dir1/*
Simple. And just add “-x”'s as needed (or use an exclusion file).
Not how it works here, it would seem. AFAICT all “-x” options are ignored. (The entries in an exclusion file also.) For instance, “-x diy/mplayer/*” should ignore everything in the <diy/mplayer> directory. It does not. I have tried fully qualified paths as well; no joy.
What is different about ZIP on linux?
Can files be excluded?
What am I missing?
have you tried it exactly the way the man lays it out in one line, and it didn’t work?
It works on the command line, either quoted or escaped, for multiple “-x” options.
It is a bit confusing since “zip -r * archive …” works but “zip -r ‘’ archive …" does not (“file * not found”). I tried finessing it with "zip -r './’ archive …”; no go there.
For the exclude file the man page indicates each pattern is on a separate line. I would swear that I tried non-quoted or non-escaped strings for each line entry. Apparently I did not since it now works as expected.
Some things are meant to be quoted/escaped and some not. Filename arguments should not be quoted since you want the shell to expand the pattern. However exclude arguments should be quoted because you want the pattern to survive into the zip program where it will be used as a pattern.
One is a shell glob, the other is a regex pattern. The difference is who is meant to interpret it. That dictates whether it should be quoted or not.