4

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?

2 Answers2

4

for x in *.zip; do unzip -d "$(basename "$x" .zip)" "$x"; done

janmoesen
  • 206
  • 1
  • 5
4

no need to use external basename

for file in *zip
do
 unzip -d "${file%.zip}" "$file"
done
user37841
  • 341
  • 1
  • 2