I didn't realize how to do this until just now so I thought I'd post about it. Suppose you have a directory on your box called "my_files" and you wish to compress it into a zip file. One level above the directory, use the following command

zip -r files.zip my_files/
14 Years
Discussion Span
Last Post by i686-linux

that is so Windows...

Just kidding. That works great, but you can squeeze even more compression out of it if you use tar with bzip2 compression:

tar -cvjf files.tar.bz2 my_files/

Zip might get about 2x compression, but I've seen bzip2 get anywhere from 2x to 5x compression. If space is a concern, then I'd check it out.


yeah, the whole difference with tar.gz and bzip2 is that bzip2 gives you more compression, so file sizes are small, but bzip2 is a lot more resource intensive when decompressing. So when size is an issue, use bzip2.


I usually use a shoe horn, some baby oil, and a really big mallet. :p

But do you prefer a crowbar or a chisel for decompression?:cheesy:

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.