1134Folder Actions in macOS
Folder Actions are the hidden superpowert in macOS. They are triggered when files are added to a folder, they then can execute an action.
The Action can be written in Automator, AppleScript or Javascript.
They are great for repetitive actions.
Problem: I have a Google Sheet that I am exporting as CSV, which in turn is used to contruct a table within Hugo. Downloading the CSV from Sheets puts it on the Desktop.
This action checks the Desktop, if it finds the file, it moves it.
Writing the Action in Automator
Filter Finder Items makes sure only the desired files are affected.
Setting up Folder Action
- Select your Folder
- Right-click and say
Services->Folder Actions Setup...
Choose a Script to attach.
Now whenever a file matching the criteria is added to the folder, the Folder Action is executed.