Zipping Multiple Folders Into Separate Zip Files

Here's a bash script that will zip all folders in the current directory into separate .zip files:

for i in */; do zip -r "${i%/}.zip" "$i"; done

I had to do this to 75+ folders today and this definitely saved me some time. It works on macOS too!

Author avatar

About the author

Creator of Surreal CMS and other web things. Follow me for tweets about JavaScript, CSS, and web programming.