Created
August 8, 2016 13:37
-
-
Save ableasdale/2859bd709d96e58240c5cda2b7ae56bb to your computer and use it in GitHub Desktop.
Unpack individual zip files to separate directories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment