Skip to main content
coreydaley.dev

Archive a folder automatically with Purrchiver and Shortcuts

People asked for watch folders: drop files into a folder, get an archive somewhere else. Others wanted a nightly archive of a project folder. So I built both into Purrchiver: archive rules, a folder watcher and a scheduler, more than 4,000 lines with the tests. Then I deleted all of it, because your Mac can already do it.

Not because it didn’t work. Because of what it needed. Keeping access to a rule’s folders across launches needed a new sandbox entitlement in my build. Running rules while the app is closed needed a background engine and a login item. Each of those is a standing grant: a login item is something you’d rightly question when it shows up in System Settings, and a remembered folder grant is access the app keeps whether or not you’re using it. That’s a lot to ask for in an app whose pitch is that it stays small and gets out of the way, when the Mac already has a tool that does most of this job.

That tool is Shortcuts. Since macOS Tahoe it can run a shortcut when files land in a folder or at a time of day, and Purrchiver already has a Create Archive action. Any folder access belongs to Shortcuts, not Purrchiver, so Purrchiver needs no new permission and nothing running in the background.

What you need

  • macOS Tahoe (26) or later for Shortcuts automations on the Mac. Older systems can get there another way; see Before macOS Tahoe.
  • Purrchiver from the Mac App Store.
  • For ZIP, nothing else. Create Archive is free for the plain formats, including ZIP, Apple Archive (AAR), tar and .tar.gz. The one-time $9.99 unlock adds the other formats, like 7z and Zstandard, and any archive with a password. The full list is on What’s free vs. the unlock.

Recipe 1: archive new files as they arrive

On macOS 27, a trigger is part of the shortcut itself: you add it at the top, like any other action. (On Tahoe, automations live in their own list instead; see On macOS Tahoe below.) Make a new shortcut called Archive Inbox and build it from the top down.

1. The trigger

  1. In the action library, open the Automation category. Under Filesystem, add Folder. It appears at the top of the shortcut as When items are changed in folder.
  2. Click Choose Folder… and pick the folder to watch. Use a folder you made for this, not Downloads; see files still being written.
  3. Under When Any Item Is, tick Added. The trigger stays off until a folder and at least one of Added, Modified or Removed are set.
  4. Expand the trigger with the arrow next to its title. Automation should be ticked, so it runs on its own. Notify is up to you.

A watched folder can hold up to 10,000 items. Ignore subfolders stops it reacting to changes deeper down.

2. The archiving

Below the trigger, add three actions:

  1. Format Date: the current date. Set Date Format to Custom and enter yyyy-MM-dd HHmmss. This becomes the archive’s name, so every run gets a name that tells you when it ran.
  2. Create Archive (Purrchiver’s actions are under Apps). Shortcuts doesn’t connect it to the trigger for you: Control-click Files and choose the trigger’s output. Set Format to ZIP and Archive Name to the formatted date; Purrchiver adds the .zip itself. Expand the action and turn off Show When Run, so it doesn’t stop to show you the result. Leave Password empty unless you’ve unlocked encryption.
  3. Save File. It connects to Create Archive’s result on its own. Expand it, turn off Ask Where To Save, and pick the destination folder. The destination must not be inside the folder you’re watching.

Before you rely on it, drop a couple of test files into the folder while you’re watching. Any permission prompt appears then, instead of stalling a run nobody is looking at.

The files you drop stay where they are, because Create Archive copies and never moves. The watched folder keeps growing, so clear it out now and then.

On macOS Tahoe

On Tahoe the trigger isn’t part of the shortcut. Build Archive Inbox without the trigger, with Create Archive’s Files set to the shortcut’s input. Then in the Shortcuts sidebar choose Automation, make a new automation with the Folder trigger, choose the folder and Added, set it to run immediately, and pick Archive Inbox.

Recipe 2: archive a folder on a schedule

For “every night at 11, archive my project folder”:

  1. Duplicate Archive Inbox and call the copy Archive Project Nightly, so Recipe 1 keeps working.
  2. Just below the trigger, add Get Contents of Folder pointing at your project folder, with Recursive off, and set Create Archive’s Files to its result. You get the folder’s files and subfolders at the top of the archive, and Create Archive walks each subfolder, so nothing is left out.
  3. Replace the Folder trigger with Time of Day, from the same Automation category, and pick the time and how often it repeats. (On Tahoe, make a separate Time of Day automation that runs Archive Project Nightly.)

Keep the Format Date step. Without it, Save File doesn’t replace last night’s archive; it saves Archive 2.zip, Archive 3.zip and so on, and the names stop telling you anything.

One more thing: plan on the Mac being awake and logged in at that time. If yours sleeps at 10:30, don’t count on an 11 o’clock archive.

Four ways this can bite you

Big folders. Create Archive hands the finished archive to Save File as data in memory. That’s fine for documents, screenshots and downloads. I haven’t found the ceiling, and it depends on your Mac’s memory. On 1.0.1, archive anything big from Purrchiver’s window instead. From 1.1, expand Create Archive and set its Destination Folder New in 1.1. The archive is then written straight into that folder instead of being held in memory, and you can drop the Save File step. If the name is taken, it gets a number (Archive 2.zip) rather than replacing the old one. The same rule applies as for Save File: the destination must not be inside the folder you’re watching.

Files still being written. A folder trigger reacts to a file appearing, not to it being finished, so it can fire while a download is halfway done or a big copy is still running. Archive it then and you get half a file. Let downloads finish in Downloads, then drag the finished file into the watched folder. A move within the same drive is instant, so the file arrives complete.

Saving into the folder you’re watching. If the destination is inside the watched folder, each new archive counts as a new file, which triggers another archive, which triggers another. Always save somewhere else.

Passwords. Encrypted archives need the unlock. A password typed into Create Archive is saved inside the shortcut, so treat that shortcut as a secret: shortcuts sync through iCloud to your other devices, and anyone you share it with gets the password too. If you make encrypted Apple Archives, Purrchiver needs a password of at least 20 characters. Shortcuts’ Ask Each Time keeps the password out of the shortcut, but then the automation needs you there to answer, which defeats the point.

Before macOS Tahoe

Purrchiver runs on macOS 14.6 and later, but Shortcuts automations only came to the Mac with Tahoe. On Sonoma and Sequoia you can still get both recipes; the shortcuts stay the same, and older Mac features do the triggering.

Watch a folder with a Folder Action.

  1. In Automator, make a new Folder Action and choose the folder to watch.

  2. Add Run Shell Script, set Pass input to as arguments, and use:

    for f in "$@"; do
      shortcuts run "Archive Inbox" -i "$f"
    done
  3. Save it. Automator attaches it to the folder. If nothing happens, right-click the folder, choose Services → Folder Actions Setup, and make sure Enable Folder Actions is on.

This runs the shortcut once per added file, so you get one archive per file. The seconds in the archive name keep them from colliding.

Run on a schedule with launchd. Shortcuts has no time-of-day trigger before Tahoe, but macOS’s own scheduler can run the shortcut. Save this as ~/Library/LaunchAgents/local.archive-project-nightly.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key><string>local.archive-project-nightly</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/bin/shortcuts</string>
    <string>run</string>
    <string>Archive Project Nightly</string>
  </array>
  <key>StartCalendarInterval</key>
  <dict><key>Hour</key><integer>23</integer><key>Minute</key><integer>0</integer></dict>
</dict>
</plist>

Then load it once:

launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/local.archive-project-nightly.plist

If the Mac is asleep at 11, launchd runs the job when it wakes, so the archive is late instead of missing.

Going further

The Shortcuts help page lists every Purrchiver action if you want to go further, like verifying a download before you archive it, or extracting archives as they arrive.

Would you rather have watch folders built into the app, or is a Shortcuts recipe you control the better deal?

Related posts