views:

51

answers:

2

I'm try to determine how to use the zip cmd line tool to move a file (uncompressed) in to a zip of compressed files (ie I want a zip in the end with all files but one compressed, b/c the one file is another compressed file).

Anyone know how to do this?

+1  A: 

It looks like you could use -n option to just store the files with defined extensions together with -g option to append the file to archive.

I didn't test it, but something like this should do the trick:

zip -gn .foo archive.zip myAddedFile.foo

Although documentation states that, by default, zip does not compress files with extensions in the list .Z:.zip:.zoo:.arc:.lzh:.arj, so if you are adding a file with one of those extensions you should be fine.

Documentation to the command is here

skajfes
thanks for the great answer, sorry I didn't ask my question clearly enough. +1 though.
Erik Vold
A: 

-m is what I wanted, moves the file(s) into a zip.

Erik Vold
Correct me if I am wrong but doesn't -m option just delete the source file after it adds it to the archive? And it has nothing to do with your question.
skajfes
that's what I want, just forgot to mention it, I'll update the question.
Erik Vold