Skip to content

Instantly share code, notes, and snippets.

@pavgup
Created September 16, 2019 13:55
Show Gist options
  • Save pavgup/dd3679cb1037fbf436aeb756ecc9c71a to your computer and use it in GitHub Desktop.
Save pavgup/dd3679cb1037fbf436aeb756ecc9c71a to your computer and use it in GitHub Desktop.
Fusion Export Nested Unzipper
#!/bin/bash
# Nested Unzipping, Updated for MacOS Find Utility
# Pavan Gupta - September 16, 2019
# Drop this script into a directory with your zip file, execute, wait for nested directories
# TODO: Zips with zip files in them having the same name would
# cause unzip to drop files into the same directory causing collisions potentially
function extract(){
unzip $1 -d ${1/.zip/} && eval $2 && cd ${1/.zip/}
for zip in `find . -maxdepth 1 -iname '*.zip'`; do
echo $zip
extract $zip 'rm $1'
done
cd ..
}
extract 'somefile.zip'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment