Created
January 8, 2021 20:30
-
-
Save jamesdeluk/65a5342059ee4d2724d5fb268b86f880 to your computer and use it in GitHub Desktop.
bash--unzip-to-folders
This file contains 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/bash | |
mkdir zips; | |
for i in *.zip; do | |
count=`unzip -l $i | rev | cut -d' ' -f2 | rev | xargs` | |
if [ $count -gt 1 ]; then | |
filename=`echo ${i:0:-4}`; | |
mkdir $filename; | |
unzip -d $filename $i; | |
else | |
unzip $i; | |
fi; | |
mv $i zips; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment