Skip to content

Instantly share code, notes, and snippets.

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 ntamvl/28bfb0594a1aebc0b4867d69d80ad31d to your computer and use it in GitHub Desktop.
Save ntamvl/28bfb0594a1aebc0b4867d69d80ad31d to your computer and use it in GitHub Desktop.
Compress multiple folders, each into its own zip archive

Compress multiple folders, each into its own zip archive

for i in */; do tar -czvf "${i%/}.tar.gz" "$i"; done

Example:

for i in */; do 
  tar -czvf "/Volumes/TamProjects/Tam/Projects/${i%/}.tar.gz" "$i"; 
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment