Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I convert .tar.gz and .tar.bz2 files to .7z files using the command line?

share|improve this question
3  
You might be able to edit this script converting from zip to fit your demands? Also there is an online converter supporting the mentioned formats. –  N.N. Jun 26 '11 at 8:52
    
@N.N.: Thanks for the link... it seems to be what I want, aside from the fact that it requires a temporary directory (which is nontrivial, given that my files are big). I'll give it a try anyhow; thanks. –  Mehrdad Jun 26 '11 at 8:57
1  
I'm pretty sure that you can't avoid writing the files to disk in an uncompressed form. I don't think any useful compression algorithm can do its work without having the whole file to look at. –  Lukasa Jun 26 '11 at 10:05
    
Would the biggest of your files fit into memory uncompressed? If so, you might find it worthwhile to use a ramdisk for the temporary files? –  therefromhere Jan 6 '13 at 1:57

1 Answer 1

Update: I missed the 'windows' tag on your question completely.
So, unless you use some unix tools (Cygwin?), this answer is not usable there.
I am expecting cygwin to implement this pipe correctly -- you'll need bash, tar, bzip2 and 7z from the environment.


You can pipe the tar output into a 7z like this,

tar xfj filename.tar.bz2 | 7z a -si filename.7z

and similarly,

tar xfz filename.tar.gz | 7z a -si filename.7z

This will save you the disk-space for extracted data -- but its not converting inline.
You will still need sufficient space to store the '7z' being created from the tarball.
You can only delete the tarball after the pipe ends.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.