Tuesday, March 10, 2009
Using folder actions in OS X to automate tasks
One nice feature of OS X that I was unaware of until recently were folder actions. They can be used to set up a folder as a "dropbox" which can perform specific tasks assigned to the folder through the use of Applescripts. Some of the default tasks included with OS X are displaying a prompt any time a file is added to a folder, duplicate a file as a jpg, tif, or png file, or rotate an image left of right. If you're good with Applescript, you can create customized scripts so it will do exactly what you want it to. It's fairly easy to configure folder actions. There are two options for enabling/disabling folder actions.
One way is to create the folder you want to use, then Control+Click on it and select "Enable folder actions". After doing that, Control+Click on it again and you should see an option for "Attach a folder action". Select that, and then pick the script you want the folder to execute. You could also use Control+Click and then select "Configure folder actions", which lets you manage all of the folders that have folder actions enabled, along with which script(s) each folder users. There are some preloaded scripts with OS X, and you can also use customized AppleScripts if you know what you're doing to create those. The default location for the built-in scripts on a Mac Desktop is Macintosh HD->Library->Scripts->Folder Action Scripts.
The other way to get into the Configure folder actions is only applicable if you're setting it up on an OS X Server. If you are using OS X server to share folders that you want to attach scripts to, you can go to Applications->AppleScript->Folder Actions Setup and do the same thing as above. The default location of scripts on OS X server is the same, but you can also access them in the Applications->AppleScript->Example Scripts shortcut.
If you want more sources, check out:
Or just Google for OS X Folder actions, and I'm sure you'll find plenty other sites offering resources to help you out.