Batch-process files in Finder using AppleScript's Finder dictionary or the macOS Shortcuts app, invoked non-interactively from the command line

domain: developer.apple.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Use tell application "Finder" blocks in AppleScript to iterate over items of a folder and apply rename/move/duplicate operations through Finder's native scripting dictionary
  2. Run the script non-interactively with osascript /path/to/script.applescript from Terminal or a launchd job
  3. Alternatively build the batch workflow visually in the Shortcuts app using Finder-related actions and run it headlessly with the shortcuts command-line tool
  4. Pass file input into a shortcut from the command line when the shortcut expects file input, per the shortcuts CLI's documented input options
  5. Grant the calling process (Terminal, or the specific binary invoking osascript/shortcuts) Automation permission for Finder/System Events in System Settings > Privacy & Security

Known gotchas

Related routes

Run and chain a macOS Shortcut from the command line alongside osascript
support.apple.com · 6 steps · unrated
Run a macOS Shortcut non-interactively from a shell script, piping file input and capturing typed output
support.apple.com · 5 steps · unrated
Run macOS Shortcuts by name from the command line and pass file input/output using the shortcuts CLI
support.apple.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans