Skip to content

Instantly share code, notes, and snippets.

@doniz
Created October 21, 2016 19:30
Show Gist options
  • Select an option

  • Save doniz/a08af93d37640a54f044079c38197d64 to your computer and use it in GitHub Desktop.

Select an option

Save doniz/a08af93d37640a54f044079c38197d64 to your computer and use it in GitHub Desktop.
unzip multiple files into directories
# 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