Skip to content

Instantly share code, notes, and snippets.

@tirzasrwn
Created March 17, 2022 04:34
Show Gist options
  • Save tirzasrwn/0724435da856bb3f7f3e02c260ab079c to your computer and use it in GitHub Desktop.
Save tirzasrwn/0724435da856bb3f7f3e02c260ab079c to your computer and use it in GitHub Desktop.
Zip all folders command
$ tree -d
+ MyDirectory/
| |
| + Folder_01/
| |
| + Folder_02/
| |
| + Folder_03/
|

After this command MyDirectory will have Folder_01.zip, Folder_02.zip and Folder_03.zip. Command:

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