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/

Recommended Answers

All 4 Replies

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.

Member Avatar for TKSS

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

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:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.