Folder Actions for OS X explained – with real-world examples

What are Folder Actions?

In a nutshell, Folder Actions are scripts that can be attached to folders. They enable events (actions) to take place when items are added or removed from that folder. Events can also occur when the folder is opened, closed or moved.

Real-World Examples

  • When you put images in a certain folder, they’re automatically converted to JPG
  • When you put files in a certain folder, they’re automatically uploaded to a web server
  • When you close a Finder window, all the sub-folder windows close as well
  • When new files are placed in a certain folder, you’re notified
  • When new files are placed in a certain folder (like your Desktop or download folder) they’re moved based on file type
  • See more in the Folder Action Resources section
  • How to enable and use Folder Actions

    1. For this example we’ll create a Folder Action that converts images to JPG format just by dropping them into a folder (this particular Folder Action is included with OS X). Start by creating a new folder.
    2. Now right-click (ctrl-click) on that new folder and select Enable Folder Actions

    3. click to enlarge

    4. Again, right-click (ctrl-click) that same folder and this time select Attach a Folder Action…

    5. click to enlarge

    6. You’ll probably be presented with a list of scripts. If you’re not, you’ll need to navigate to the folder that contains all of the Folder Action scripts. They’re in Mac HD/Library/Scripts/Folder Action Scripts/. Select Image – Duplicate as JPEG and then click Choose

    7. click to enlarge

    8. That’s it. Now drag a non-jpg picture into that folder (a PNG, GIF etc).
    9. Ta-da! The Folder Action will have duplicated your image, but this time as a JPG. It will also save the original image.

    10. click to enlarge

    11. If you ever want to change or disable a Folder Action, right-click (ctrl-click) the folder and choose Configure Folder Actions…
    12. From here you’ll be able to manage all of your Folder Actions in one place.

    Folder Action Resources 

    Here are some sites that provide pretty cool Folder Action scripts etc –

  • Auto-sort files dropped into the System Folder (like OS 9)
  • Automatically add/import files to iTunes when they’re placed in a folder
  • Upload files using Cyberduck when they’re placed in a folder (Upload Sample.scpt) – read the readme.txt for more info
  • Use Folder Actions and Automator to keep your Desktop super-clean
  • Automatically import (and tag) Photo Booth photos into iPhoto
  • Writing Folder Action scripts