zip -i

Associate
Joined
27 Jun 2008
Posts
1,536
I'm new to using Linux and I'm trying to get zip to compress some files. I'm trying to find more infomation on the option -i for including files but can't find anything much useful through Google. All documentation seems to be a copy and paste from another site.

I want it to compress the files with a specified name. For example I have:

myfile.doc
myfile.xls
myfile.pdf

I want it to only compress myfile.doc and myfile.xls.

I can only find an example for files named with a certain suffix, ie:

zip -r myarchive . -i \*.doc

But I want it the other way round so:

zip -r myarchive . -i \myfile.*

which doesn't work. I also want it to exclude files name *.pdf. I don't know the syntax well so don't know what to try.
 
Associate
OP
Joined
27 Jun 2008
Posts
1,536
Still doesn't work. :(

I think it might be because the files are in subdirectories. It works when using *.doc but not when I use myfile.*. If I put the files in the CWD it'll archive them when using myfile.*.

EDIT: Found the solution. I needed to put another wildcard in at the beginning, so: -i *myfile.*
 
Last edited:
Back
Top Bottom