Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unzip a bunch of zips into their own directories

Tags:

linux

unzip

I have a bunch of zip files I want to unzip in Linux into their own directory. For example:

a1.zip a2.zip b1.zip b2.zip

would be unzipped into:

a1 a2 b1 b2

respectively. Is there any easy way to do this?

like image 247
Alexander Avatar asked Mar 17 '10 16:03

Alexander


People also ask

Can you extract multiple zip folders at once 7-Zip?

zip files in one operation, rather than one by one? Get multiple files to be extracted into separate folders. Right-click on them, navigate to the 7-Zip pop-up menu, and choose the: Extract to "*\" option .


1 Answers

Add quotes to handle spaces in filename.

for file in *.zip
do
  unzip -d "${file%.zip}" "$file"
done
like image 154
ghostdog74 Avatar answered Sep 20 '22 13:09

ghostdog74