Automate mundane routines with MacOS Folder Actions

Folder Actions automatically run scripts when files are added, removed, or modified in specific folders on macOS.

How to set up:

  1. Right-click a folder in Finder
  2. Select Services > Folder Actions Setup
  3. Enable folder actions for that folder
  4. Attach a script (AppleScript or shell script) to run on folder events

Common automation examples:

Example AppleScript:

on adding folder items to this_folder after receiving added_items
    repeat with this_item in added_items
        -- Process each added file
        tell application "Finder"
            -- Do something with this_item
        end tell
    end repeat
end adding folder items to

Use cases:

Built into macOS, no third-party tools needed.

Original source