Sweepfor Mac

Mac maintenance

Using Automator on Mac for Routine Cleanup Tasks

Build cleanup workflows with Mac's Automator app. Old but reliable — automate file moves, batch operations, and routine maintenance tasks.

8 min read

Automator is the unsung workhorse of macOS automation. It’s been around since Mac OS X 10.4 (2005), and Apple keeps shipping it even as Shortcuts gets more attention. The reason: for certain tasks — especially batch file operations and right-click context-menu actions — Automator is still the cleanest option.

This guide is about using Automator specifically for routine cleanup. Where it shines, where Shortcuts has overtaken it, and the workflows that earn their keep.

What Automator does well

Three things Automator still beats Shortcuts at:

  1. Quick Actions that appear in Finder’s right-click menu. Shortcuts can do this, but Automator’s Quick Actions feel more native and don’t have permission quirks.
  2. Batch file operations with shell scripts mixed in. Automator’s “Run Shell Script” action accepts file lists naturally — Shortcuts is clunkier here.
  3. Folder Actions — Automator workflows attach to folders cleanly, fire reliably, and have been doing so for 20 years.

Where Shortcuts wins:

  • Cross-device sync
  • Modern UI
  • Calendar-triggered automation
  • Easy notifications and dialogs

A reasonable rule: if you want a context-menu action or a folder watcher, Automator. If you want something that runs on a schedule or syncs to your iPhone, Shortcuts.

Workflow 1: Right-click “Compress and Archive”

A Quick Action you can invoke on any file or folder to zip it and move the original to the Trash.

  1. Open Automator (in Applications)
  2. Choose Quick Action as the document type
  3. Set Workflow receives current to “files or folders” in Finder
  4. Drag in the Run Shell Script action
  5. Set “Pass input” to “as arguments”
  6. Paste:
for f in "$@"; do
    parent=$(dirname "$f")
    name=$(basename "$f")
    cd "$parent"
    zip -r "${name}.zip" "$name"
    mv "$name" ~/.Trash/
done
  1. Save as “Compress and Trash”

Now right-click any folder, choose Quick Actions → Compress and Trash, and it zips up plus removes the original. Useful for archiving completed projects in one click.

Make cleanup automaticSweep does the routine cleanup so you can stay in your work. Get Sweep free →

Workflow 2: Right-click “Move to Old Files”

For folders that fill up with junk you don’t want to delete but want out of the way.

  1. New Quick Action, receives files/folders in Finder
  2. Add Run Shell Script with:
DEST="$HOME/Documents/Old Files/$(date +%Y-%m)"
mkdir -p "$DEST"
for f in "$@"; do
    mv "$f" "$DEST/"
done
  1. Save as “Move to Old Files”

Right-click anything, send it to a dated archive folder. Doesn’t delete, just gets it out of your active folders. Review the Old Files folder once a quarter.

Workflow 3: Folder Action — auto-organize Downloads

Automator was built for this. Create a Folder Action that watches Downloads and sorts files by extension.

  1. New Automator document, choose Folder Action
  2. At the top, set “Folder Action receives files and folders added to: Downloads”
  3. Add Run Shell Script action, “Pass input as arguments”
  4. Script:
for f in "$@"; do
    ext="${f##*.}"
    case "$ext" in
        pdf|PDF)
            target="$HOME/Downloads/PDFs"
            ;;
        png|jpg|jpeg|gif|heic|webp)
            target="$HOME/Downloads/Images"
            ;;
        mp4|mov|avi|mkv)
            target="$HOME/Downloads/Videos"
            ;;
        zip|dmg|pkg)
            target="$HOME/Downloads/Installers"
            ;;
        *)
            continue
            ;;
    esac
    mkdir -p "$target"
    mv "$f" "$target/"
done
  1. Save as “Sort Downloads”

The case statement only sorts known types. Other files stay in Downloads root, which is intentional — those are the ones you’ll want to look at.

A small gotcha: this fires on every file added, including partial downloads. Some apps create a .crdownload or .part file first, then rename when done. The script will move the partial. Add a 2-second delay or filter for incomplete files if this bites:

sleep 2  # let downloads complete

Workflow 4: Batch rename with shell

Automator has a built-in Rename Finder Items action that handles common cases (add date, sequential numbers, find/replace). For anything weirder, drop in Run Shell Script.

Example — rename every Screen Shot YYYY-MM-DD at HH.MM.SS PM.png to a clean ISO timestamp:

for f in "$@"; do
    if [[ "$(basename "$f")" =~ Screen[[:space:]]Shot[[:space:]](.*)[[:space:]]at[[:space:]](.*)\.png ]]; then
        date_part="${BASH_REMATCH[1]}"
        time_part="${BASH_REMATCH[2]//./-}"
        time_part="${time_part// /}"
        newname="$(dirname "$f")/screenshot-${date_part}-${time_part}.png"
        mv "$f" "$newname"
    fi
done

Save as a Quick Action; right-click selected screenshots; rename them all at once.

Tip: Test Automator workflows on a backup folder first. Once a workflow runs against real files, undo isn't always possible. Make sure you have a Time Machine backup before running batch operations on important folders.

Workflow 5: Schedule cleanup with Calendar

Automator workflows can be triggered by Calendar events. The trick is to build the workflow as a regular Application document (not a Quick Action), then have a recurring Calendar event “open” it.

  1. New Automator Application
  2. Add Run Shell Script:
# Clear user caches
rm -rf ~/Library/Caches/* 2>/dev/null

# Empty Trash older than 14 days
find ~/.Trash -mindepth 1 -mtime +14 -delete 2>/dev/null

# Old downloads
find ~/Downloads -mindepth 1 -mtime +90 -delete 2>/dev/null

# Notify
osascript -e 'display notification "Weekly cleanup complete" with title "Mac Cleanup"'
  1. Save as ~/Applications/Weekly Cleanup.app
  2. In Calendar, create a recurring event Sundays at 3am
  3. Set the alert to “Open file → Weekly Cleanup.app”

Calendar wakes up the Mac if needed (with the right Energy Saver settings) and runs the app. Notification confirms it ran.

This is the closest macOS gets to cron without using launchd. Less flexible than launchd but easier for non-technical users.

Workflow 6: Print Plugin for cleanup

Automator can build print plugins that show up in the Print dialog’s PDF dropdown. Less obvious for cleanup, but useful for “Save PDF and shred original” workflows for sensitive documents.

The pattern: print → save as PDF → secure-delete the original. Useful for receipts and tax documents you want to keep but not in the same form.

for f in "$@"; do
    rm -P "$f"  # secure overwrite + delete
done

rm -P overwrites with random data before deleting. Slower than regular rm but appropriate for sensitive content. Note: SSDs make secure delete less meaningful (wear leveling), but it’s still better than nothing.

Skip the manual huntSweep finds every cache, log, and forgotten file in seconds. Download Sweep free →

Debugging workflows

Automator gives less feedback than Script Editor. Tricks for figuring out why a workflow isn’t doing what you expect:

  • Use Run Shell Script with set -x at the top to log every command. Output goes to Console.app (filter by “automator”).
  • Add a Display Notification action between steps to confirm it’s reaching that point.
  • For Folder Actions, check Console for “FolderActionsDispatcher” messages.
  • Test the script in Terminal first with the same arguments before pasting into Automator.

Permissions are the most common silent failure. macOS may block Automator from touching certain folders without warning. Check System Settings → Privacy & Security → Full Disk Access and add /System/Library/CoreServices/Automator Workflow Runner.app if needed.

When Automator gives up

Apple has been quiet about Automator’s future. It still ships in macOS 14 and 15, but it hasn’t gotten major updates in years. Some things to know:

  • Automator’s “Photos” actions broke during the Aperture-to-Photos transition and never fully recovered
  • Some actions assume macOS 10.x APIs that have changed
  • Saved workflows from 2010 generally still work
  • New workflows with shell scripts are the safest bet for longevity

For new automation, Shortcuts is what Apple wants you to use. For existing workflows, Automator keeps working. For specific niches (Quick Actions, Folder Actions, batch shell scripts), it’s still the right tool.

Migrating to Shortcuts

If you have a workflow library and want to consolidate, the migration path:

  • Quick Actions → can be rebuilt as Shortcuts triggered by Quick Actions menu
  • Folder Actions → also work in Shortcuts now
  • Calendar-triggered apps → use Shortcuts via launchd or Calendar

Most one-screen workflows port in 10–15 minutes. Complex shell-heavy workflows are easier to leave in Automator.

A practical starting point

Pick one task you do manually that takes 30 seconds and you do at least weekly. Build an Automator Quick Action for it. Use it for a month. If it sticks, build another.

The trap is building elaborate automation for tasks you do once a quarter — the maintenance cost outweighs the benefit. Stick to high-frequency, low-effort wins.

← Back to all guides