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

by Ross McKillop on January 30, 2007

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
  • Related Posts:
  • Review: World Golf Tour
  • An introduction to Real Desktop - a Windows Desktop replacement
  • Review: Apogee Search
  • Roundup: The Under-appreciated Posts
  • How to send email from the Linux command line
  • 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.


    Bookmark and Share

    { 6 trackbacks }

    Jay’s Headspace - » Eager Beaver for 01/31/2007
    02.04.07 at 9:22 pm
    Folder Action for automated upload of Aperture web galleries at The Joy of Scripting
    11.30.07 at 11:59 pm
    Final Cut Producer | Mac Folder Actions Explained
    03.04.08 at 6:19 am
    Looky: An AppleScript Folder Action utilizing Quick Look at The Joy of Scripting
    03.28.08 at 12:59 am
    AppleScript ::: Ignorantenprogramm released | macfidelity
    03.30.08 at 5:03 am
    Folder Actions for OS X explained (with real-world examples) | The Pengas Blog
    08.11.08 at 4:29 am

    { 13 comments… read them below or add one }

    1 JP 01.31.07 at 3:52 pm

    cool

    2 Filip Lam 01.31.07 at 7:34 pm

    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 01.31.07 at 11:29 pm

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

    4 Nick 01.31.07 at 11:42 pm

    JP, Filip and UT -

    Glad to hear it helped!!

    5 Hani 02.16.07 at 7:35 am

    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 10.06.07 at 5:38 pm

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

    7 Murphy 11.13.07 at 9:24 pm

    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 12.10.07 at 2:36 pm

    thank you very much. You gave an easy explanation.

    9 Muthu 06.18.08 at 6:05 am

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

    10 Emilio Marte 06.25.08 at 12:37 pm

    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 06.25.08 at 12:40 pm

    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 07.04.08 at 11:49 pm

    Ok i give you thumbs up!

    13 slub 08.26.08 at 9:51 pm

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

    Leave a Comment

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>