On a Mac, how do I programatically compress each folder in a folder?
As part of cleaning out some old drive storage, I needed to zip a folder of folders. I could, of course, do this by hand, but it was a lot of folders and would be rather tedious. Instead of doing that for 10 minutes, I took 2 hours to figure out an automated solution!
I tried Forklift, Automator, Shortcuts, and Pathfinder. Nothing could do it; at least I couldn’t find a way to do it. After some searching, I found partial solutions in AppleScript. Here’s what I came up that solved my problem.
tell application “Finder" set theFolders to selection repeat with aFolder in theFolders set theItem to aFolder as alias
set itemPath to quoted form of POSIX path of theItem
set fileName to name of theItem
set theFolder to POSIX path of (container of theItem as alias)
set zipFile to quoted form of (fileName & ".zip")
do shell script "(cd " & quoted form of theFolder & " && zip -r " & zipFile & " " & quoted form of fileName & ")"
end repeat
end tell
A key feature of this solution is that it doesn’t create an archive with the full pathname. The zip file contains only the folder name and “down”.
Featured writing
When your brilliant idea meets organizational reality: a survival guide
Transform your brilliant tech ideas into reality by navigating organizational challenges and overcoming hidden resistance with this essential survival guide.
Server-Side Dashboard Architecture: Why Moving Data Fetching Off the Browser Changes Everything
How choosing server-side rendering solved security, CORS, and credential management problems I didn't know I had.
AI as Coach: Transforming Professional and Continuing Education
Transform professional and continuing education with AI-driven coaching, offering personalized support, accountability, and skill mastery at scale.
Books
The Work of Being (in progress)
A book on AI, judgment, and staying human at work.
The Practice of Work (in progress)
Practical essays on how work actually gets done.
Recent writing
Dev reflection - January 25, 2026
I spent part of today watching a game fall apart in my hands. Not because it was broken—technically everything worked fine. It fell apart because I'd confused being clever with being usable.
Dev reflection - January 24, 2026
So here's something I've been sitting with lately. I spent the last couple days working across a bunch of different projects, and I noticed something strange. In almost every single one, the most i...
Why customer tools are organized wrong
This article reveals a fundamental flaw in how customer support tools are designed—organizing by interaction type instead of by customer—and explains why this fragmentation wastes time and obscures the full picture you need to help users effectively.