Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gzip and bzip2 question

Status
Not open for further replies.

hokky

Technical User
Nov 9, 2006
170
AU
Hi guys,

for compressing directory, I usually tar the directory becomes a file and zip it.

I was just wondering whether gzip and bzip2 or zip can do to directory straight away without tarring first.

I have check man command, I don't think so. But I would like to know from your guys opinion.

Cheers,
 
It's not a matter of opinion, but a matter of fact.

A directory is just a kind of file, which is an identifier for contained files, but doesn't physically contain a file.
Therefore there isn't much sense in zipping a directory without files.
You have just the name, times and permissions - not much to be zipped.

Bzip compresses a file.
If you want to zip the content of a directory, you have to build a single file first, which might be done by tar.

You can put tar and zip in one command from the tar side:
Code:
tar -cjf output.bz2 directory

don't visit my homepage:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top