Results 1 to 5 of 5
Hi, can bzip compress files in subdirectories of the directory you tell it to? if so can you please give me the command switches or something like that? thanks...
- 11-02-2008 #1Just Joined!
- Join Date
- Aug 2008
- Posts
- 33
bzip subdirectories
Hi, can bzip compress files in subdirectories of the directory you tell it to? if so can you please give me the command switches or something like that? thanks
- 11-02-2008 #2
I don't think you can do this using bzip2 alone (though gzip has a recursion option). You can certainly do it with tar, using the -j option to invoke bzip2 as the compressor.
Code:tar -jf zipped_output.tbz directory
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 11-04-2008 #3Just Joined!
- Join Date
- Aug 2008
- Posts
- 33
ok thank you. i'll just write a program to cycle through each subdirectory and call bzip on all the files in each
- 11-09-2008 #4
Now hold on a sec. I think the solution to this depends on understanding what bzip does, and what you want.
bzip is a utility that takes a single file and compresses it. I think you can do some weird things that allow it to handle multiple files, but this is not intelligent.
Instead, if you want a single bzip archive to contain multiple files (or, say, a directory), you first create a tarball of the relevant files. A tarball is basically a box containing a bunch of different files. This is why you rarely see a straight .bz file: instead, you tend to see .tar.bz.
If you are wanting individual bzip archives of every file under a subtree, then iterating through each one is what you want (though I don't see why you would do this). If you want to compress an entire directory (including subdirectories), then make a tarball of the directory and then bzip that.
Make sense?DISTRO=Arch
Registered Linux User #388732
- 11-10-2008 #5Just Joined!
- Join Date
- Aug 2008
- Posts
- 33
thanks, i know all about tarballs though. i use them all the time, although I prefer to gzip a tarball with ultra compression rather than bzip.
I need to use bzip and compress each file individually for Counter-Strike Source fastdownload. that's just how it works.


Reply With Quote
