Command line and power tools
cron exists on the Mac but launchd is the native scheduler — and the difference matters on a laptop, because launchd runs a missed job when the machine wakes instead of skipping the week.
The job: files sitting in Downloads for over 60 days move to an archive folder. The script, saved as ~/bin/sweep-downloads.sh and made executable:
#!/bin/bash
mkdir -p ~/Downloads/Archive
find ~/Downloads -maxdepth 1 -type f -mtime +60 -exec mv {} ~/Downloads/Archive/ \;
(-maxdepth 1 leaves the Archive folder itself alone. Moving, not deleting — scheduled deletion should be earned, not defaulted.)
Jobs for your user live in ~/Library/LaunchAgents. Create com.user.sweep-downloads.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>com.user.sweep-downloads</string>
<key>ProgramArguments</key>
<array><string>/Users/YOURNAME/bin/sweep-downloads.sh</string></array>
<key>StartCalendarInterval</key>
<dict><key>Weekday</key><integer>1</integer>
<key>Hour</key><integer>9</integer></dict>
<key>StandardErrorPath</key>
<string>/tmp/sweep-downloads.err</string>
</dict></plist>
Load it:
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.user.sweep-downloads.plist
StartCalendarInterval here means Mondays at 09:00 — and if the Mac was asleep then, the job runs on wake. That catch-up behaviour is the argument for launchd over cron on anything with a lid.
The job did not run, or ran invisibly. In order:
launchctl list | grep sweep
launchctl kickstart gui/$(id -u)/com.user.sweep-downloads
cat /tmp/sweep-downloads.err
— is it loaded, run it now, read what it said. Most failures are the script path (must be absolute), permissions (the script not executable, or the shell lacking Full Disk Access for protected folders), or editing the plist without re-bootstrapping it.
launchd catches up on jobs missed during sleep and is what macOS itself uses; cron silently skips anything scheduled while the lid was closed.
Yes — WatchPaths triggers the job when a path changes, which suits react-to-arrival tasks better than polling.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Download for MacVersion 2.15.7 · macOS 13+ · 3.8 MB · notarised