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.

I generally use 7zip when on Windows and uncompressing multiple 7zip files. I have come across several articles noting that I need to concatenate multiple 7zip files to a single zip archive if I wish to uncompress in Linux.

  1. Is this necessary?
  2. Can I not specify simply the first of the multiple 7zip files?

The reason I ask is it appears that when running the command 7zr e {name_of_first_archive} it only uncompresses the first archive.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

You can extract/decompress 7z split archives, no need to concatenate the parts prior to extraction. The only requirement is that your archives must have incremental extensions of the type .NNN (where N=[0..9]) starting from .001. This is probably because when you create a split archive using 7z, it will name each part of the archive this way. Then, all you have to do is run the command on the first archive:

[me home]$ ls
diveintopython3.pdf.7z.001  diveintopython3.pdf.7z.002  diveintopython3.pdf.7z.003

[me home]$ 7zr x diveintopython3.pdf.7z.001

7-Zip (A) [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18 p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)

Processing archive: diveintopython3.pdf.7z.001

Extracting  diveintopython3.pdf

Everything is Ok

Size:       2598283 Compressed: 734003
share|improve this answer
1  
This, then, will only work if you are uncompressing one file compressed into multiple archives, not if you want to uncompress multiple, independant archives. Still, I think it is what the OP wanted, so +1. –  terdon Aug 19 '12 at 2:44
    
True, +1. When uncompressing a multi-part 7z archive created as per the 7z format (.001 etc), the archive itself might contain several files/directories and the file directory and metadata are always in last volume. I don't see how could one extract "independent" archives by passing only the first one as argument. –  don_crissti Aug 19 '12 at 14:02
    
@don_crissti - Interesting. I tried that in the first instance and it failed hence the concatenation. –  PeanutsMonkey Aug 23 '12 at 20:08
    
@PeanutsMonkey - If the parts had incremental extensions of type .7z.NNN then 7zip should work, no idea why it failed on your side. On the other hand, terdon's suggestion (and my "shortcut" from the comment on his post) will not work with parts like *.7z.NNN unless you add another wildcard before the closing quote: 7zr x '*.7z*'. One more thing (after re-reading your post): regardless the number of parts, terminal ouput will only mention the first one when echoing Processing archive: then it will jump to Extracting ... so it appears it only uncompresses the first archive. –  don_crissti Aug 23 '12 at 23:41
    
@don_crissti - I did notice that only the name of the first file is echoed however what concerned me was that it kept prompting me if I wanted to overwrite a file each time it went through the list of available compressed archives. –  PeanutsMonkey Aug 26 '12 at 19:31

Well, apparently you can't. Weird, but there you go. This little script will do what you want though (assuming your archives have the extension .7z, if not, change to whatever extension they have) :

for n in *7z; do 7zr x $n; done

Use the 'x' rather than the 'e' flag because 'e' will extract all files to the current directory while 'x' will preserve the original paths.

To make your life easier, you can add this little function to your ~/.bashrc file:

function multi7z () {
    for n in $@; do 7zr x $n; done
}

You can then uncompress multiple archives as expected:

$ multi7z *7z

or

$ multi7z a.7z b.7z n.7z

EDIT: This will work if you are uncompressing multiple, independent archives. If you have one archive split across many .7z files, use @don_crissti's answer instead.

share|improve this answer
1  
Isn't the above the same as running: 7zr x '*.7z' ? –  don_crissti Aug 19 '12 at 13:54
    
@don_crissti Why, so it is! All that was needed were the quotes! Well spotted. –  terdon Aug 19 '12 at 14:04

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.