Created
October 21, 2016 19:30
-
-
Save doniz/a08af93d37640a54f044079c38197d64 to your computer and use it in GitHub Desktop.
unzip multiple files into 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
| # taken from http://stackoverflow.com/questions/11289551/argument-list-too-long-error-for-rm-cp-mv-commands#answer-11289567 | |
| for f in *.zip; do | |
| # Creating a name for the new directory. | |
| new_dir="${f##*/}" | |
| new_dir="${new_dir%.*}" | |
| # Creating the directory if it doesn't already exist. | |
| mkdir -p "$new_dir" | |
| # Unzip contents of "$f" to "$new_dir" | |
| unzip -d "$new_dir" -- "$f" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment