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?

link|improve this question

feedback

closed as off topic by Miles Erickson, voretaq7 May 24 at 20:36

Questions on Server Fault are expected to generally relate to servers, networking, or desktop infrastructure, within the scope defined in the faq.

2 Answers

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

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.
link|improve this answer
feedback

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