Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created August 8, 2016 13:37
Show Gist options
  • Save ableasdale/2859bd709d96e58240c5cda2b7ae56bb to your computer and use it in GitHub Desktop.
Save ableasdale/2859bd709d96e58240c5cda2b7ae56bb to your computer and use it in GitHub Desktop.
Unpack individual zip files to separate directories
#!/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