Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@andrewbattista
Last active May 4, 2020 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewbattista/7c4f15eca5cb64522b0ea3bbc3140e81 to your computer and use it in GitHub Desktop.
Save andrewbattista/7c4f15eca5cb64522b0ea3bbc3140e81 to your computer and use it in GitHub Desktop.
Zip all files in a directory and rename

Zips all files within a containing directory

This zips all files in a directory and renames the zip archive according to the name of the existing directory.

for i in */; do zip -r "${i%/}.zip" "$i"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment