By Dan Moren
November 28, 2022 7:55 AM PT
Automate This: Archive a bunch of sub-folders
Sometimes you stare down the barrel of a stupid, repetitive task and think: hey, my time’s worth more than this!
Then you spend longer than the original task would have taken to create an automation for that task.
Having concluded our current season of A Complicated Profession, our Star Wars TV podcast over on The Incomparable, I decided I ought to archive all the project files to save some space on my MacBook Air’s drive. In the past, I’ve had an automated workflow to do this, using Hazel, but I hadn’t set it up again since switching to my laptop as my main work machine.1
However, rather than clicking on each individual project folder and choosing Compress…, it seemed likely that I could create a simple automation to do the work for me. And so I did!
Shortcuts is well suited to this task, allowing me to create a workflow I could launch from the Finder’s Quick Actions menu. I selected the top-level folder for the podcast and had the shortcut iterate through the contents of that folder. If it encountered a file with no file extension (which was the best idea I had for detecting if something was a folder), it would zip that up into an archive with the same name as the folder, then save it to the top-level folder2. Done.
It took a little bit of trial and error to get the save paths and naming correct3, but the end result was exactly what I’d hoped: a folder full of archives of each individual episode, which I could then drag over to my NAS before deleting them all from my drive.
Perhaps you’ll find this shortcut useful, in which case, have at.
- Once again, I’m reminded that macOS’s version of Shortcuts lacks the Automation features of the iOS version—which continues to be a glaring oversight. ↩
- That Save File action is a crucial step: otherwise it just makes a zip file and…throws it away? How strange. ↩
- I did accidentally make an earlier version recursive, where it dumped an infinite loop of folders inside the Shorcuts folder in iCloud drive. Whoops! ↩
[Dan Moren is the East Coast Bureau Chief of Six Colors. You can find him on Twitter at @dmoren or reach him by email at firstname.lastname@example.org. The latest novel in his Galactic Cold War series of sci-fi space adventures, The Nova Incident, is available now.]
If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community.