Zipping multiple folders into separate zip files

A drawing of a cartoon man pointing upwards

Heads up! This post was written in 2017, so it may contain information that is no longer accurate. I keep posts like this around for historical purposes and to prevent link rot, so please keep this in mind as you're reading.

— Cory

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!