Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Linux Applications > bzip subdirectories

Forgot Password?
 Linux Applications   I cant get "X" app to work... also discussion about linux programs.

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 11-02-2008   #1 (permalink)
Just 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
hhh3h is offline  


Reply With Quote
Old 11-02-2008   #2 (permalink)
Linux User
 
hazel's Avatar
 
Join Date: May 2004
Location: Harrow, UK
Posts: 481
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!"
hazel is offline   Reply With Quote
Old 11-04-2008   #3 (permalink)
Just 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
hhh3h is offline   Reply With Quote
Old 11-09-2008   #4 (permalink)
Trusted Penguin
 
Cabhan's Avatar
 
Join Date: Jan 2005
Location: Boston, MA, USA
Posts: 2,691
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=Gentoo
Registered Linux User #388732
Gentoo Linux, 410 GB HD, 1.2 GB RAM, Fluxbox, These are a Few of my Favorite Things
Cabhan is offline   Reply With Quote
Old 11-10-2008   #5 (permalink)
Just 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.
hhh3h is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 08:39 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2