Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have downloaded a large number of .zip files and need to extract them using 7z (p7zip) at the command line. 7z x filename0001.zip is successful, but 7z x *.zip returns a "No files to process" error.

How can I unzip the files as a batch instead of one at a time?

share|improve this question

closed as off topic by Skyhawk, voretaq7 May 24 '12 at 20:36

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

for zip in *.zip; do
    7z x "$zip"
done
share|improve this answer
up vote 2 down vote accepted

Solution:

ls -1 *.zip | xargs -L 1 7z x

Explanation:

  1. ls -1 *.zip outputs a one-column list of zip files to stdout (ls dash-one, not ls dash-ell)
  2. xargs -L 1 takes each filename returned and passes it to 7z x as a parameter.
share|improve this answer

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