Unzip All Files In A Directory
unzip *.zip, or if they are in subfolders, then something like
find . -name "*.zip" -exec unzip {} \;
Just put in some quotes to escape the wildcard:
unzip "*.zip"
This works in bash, according to this link:
unzip \*.zip
The shell script below extracts all zip files in the current directory into new dirs with the filename of the zip file, i.e.:
The following files:
myfile1.zip
myfile2.zip
Will be extracted to:
./myfile1/files...
./myfile2/files...
Shell script:
#!/bin/sh
for zip in *.zip
do
dirname=`echo $zip | sed 's/\.zip$//'`
if mkdir "$dirname"
then
if cd "$dirname"
then
unzip ../"$zip"
cd ..
# rm -f $zip # Uncomment to delete the original zip file
else
echo "Could not unpack $zip - cd failed"
fi
else
echo "Could not unpack $zip - mkdir failed"
fi
done
Source Gist
Usage:
cd /dir/with/zips
wget -O - https://www.toptal.com/developers/hastebin/suvefuxuxo.bash | bash