Skip to content


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

Mac

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
  • Posted in Mac.

    Get Simple Help tutorials just like this one in your email inbox every day - for free! Just enter your email address below:

     

    You can always opt out of this email subscription at any time.

    31 Responses

    Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

    1. JP says

      cool

    2. Filip Lam says

      Wonderful tip! I’ve been wondering what folder actions was about but never really had the time to figure it out. Thanks again!

    3. UT says

      I wish all tutorials were this clear! Excellent tip!!!

    4. Nick says

      JP, Filip and UT -

      Glad to hear it helped!!

    5. Hani says

      Thanks for the great tip. Is there a way for the music or movie folders to search the computer and add music/videos automatically?

    6. Andy says

      Great tutorial, this will help me out big time with workflow on my mac.

    7. Murphy says

      Good info, thanks.

      Here’s how to make a folder that mails files added to it to a preset address, useful for backing them up to Gmail.

      http://murphymac.com/files-mailed-magically-when-dropped-in-a-finder-folder/

    8. damn.hustle says

      thank you very much. You gave an easy explanation.

    9. Muthu says

      Awesome. Simple example which i was waiting to go though in years.

    10. Emilio Marte says

      Saludos:

      Por favor me gustaría que alguien me diga, cómo puedo hacer para que cuando alguien coloque un archivo en un folder cualquiera, que este me notifique o que se active si el mismo está abierto.

      Gracias de antemano

    11. Emilio Marte says

      Please I would like to see someone tell me, how can I do so that when someone put a file in a folder anyone, I notice that this or that is activated if it is open.

      Thanks in advanc

    12. frank says

      Ok i give you thumbs up!

    13. slub says

      Simple, easy and to the point. thank you thank you! I couldn’t find that information anywhere on apple’s site.

    14. JoDitt says

      Thanks for your simple explanation of folder actions, and especially for the real world examples.

    15. Jason Beebe says

      Great tip. I will definitely give this a go on my iMac.

    16. Mariano says

      Thanks for this tutorial.

    17. Juergen says

      I would like to know what events may trigger a folder action. Unfortunately, I cannot find a reference manual, but it seems like that adding a file is the one and only event which can start a automator script.
      My goal is to implement an action that fires if a folder is opened or closed from a remote host. In this case, iTunesFS should launch. If the connection is closed, the iTunesFS should get closed as well. Any suggestons?

    18. Fero says

      Great script, especially the notify when new file placed in folder.

      Can someone suggest a workaround for Leopard which doesn’t allow you to send a fax, unless you disable ‘Receive faxes on this computer’. I suppose the steps for sending a fax would require the steps;
      - select file to be faxed
      - when ‘Fax Pdf’ is selected, script should ‘deactivate receive fax on this computer’ and save settings and close
      - fax should then send (hopefully)
      - once fax has sent, then script should reinstate ‘receive fax on this computer’ setting.

      THanks all
      FJK

    19. Multimedia Design says

      I think you just invented the 30 hour day. This is going to give me so much free time – thanks!

    20. Derek Nugent says

      Fantastic! Many many thanks for sharing!

    Continuing the Discussion

    1. Jay’s Headspace - » Eager Beaver for 01/31/2007 linked to this post on February 4, 2007

      [...] Folder Actions for OS X explained – with real-world examples – Simplehelp [...]

    2. Folder Action for automated upload of Aperture web galleries at The Joy of Scripting linked to this post on November 30, 2007

      [...] script is designed as a Folder Action, so just attach the script to a folder of your choice and drag and drop the created web galleries [...]

    3. Final Cut Producer | Mac Folder Actions Explained linked to this post on March 4, 2008

      [...] How to enable and use Folder Actions [...]

    4. Looky: An AppleScript Folder Action utilizing Quick Look at The Joy of Scripting linked to this post on March 28, 2008

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

    5. AppleScript ::: Ignorantenprogramm released | macfidelity linked to this post on March 30, 2008

      [...] Need more examples about using folder Actions ? Check this link [...]

    6. Folder Actions for OS X explained (with real-world examples) | The Pengas Blog linked to this post on August 11, 2008

      [...] Folder Actions for OS X explained – with real-world examples – Simple Help. [...]

    7. New Item Alert « MilkHub linked to this post on February 18, 2009

      [...] simple Folder Action, adapted from one of the Apple stock scripts, which triggers a Growl message when an item is added [...]

    8. Automator to Convert Torrents with iSquint? - MacNN Forums linked to this post on April 24, 2009

      [...] can’t you have your torrent program move completed torrents to a folder then specify a folder action to happen when something gets [...]

    9. An Applescript to Move Screenshots From the Desktop — Ken Clark's Blog linked to this post on September 30, 2009

      [...] with Mac OS X from my Desktop to a designated screenshots folder.  Setting it up requires that you enable folder actions and then assign this script as a folder action to the Desktop [...]

    10. Folder Actions, UNIX style « Hello Mac World linked to this post on January 5, 2010

      [...] a folder, and have that script run whenever items are added or removed from the folder. Have a look here for a simple [...]

    11. NMDNet » Microsoft Tag Beta linked to this post on February 1, 2010

      [...] caught up with OS X (and even passed it: it’s fast and 64-bit, you can rotate images without attaching folder actions, and the taskbar now combines both the old Windows taskbar with behviors from OS X’s dock). [...]



    Some HTML is OK

    or, reply to this post via trackback.