954,174 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Creating a zip

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/
cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

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.

alc6379
Cookie... That's it
Team Colleague
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
 

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.

Eico
Light Poster
41 posts since Mar 2004
Reputation Points: 10
Solved Threads: 2
 

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

TKS
Posting Pro in Training
470 posts since Jan 2004
Reputation Points: 108
Solved Threads: 18
 
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:

i686-linux
Posting Whiz in Training
210 posts since Mar 2004
Reputation Points: 87
Solved Threads: 12
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: