OS X’s Folder Actions let you attach AppleScripts to specific folders so actions are performed automatically as soon as you add items to the folders. Once you know the basics of how Folder Actions work, you’ll inevitably start wondering what cool things they can do for you. Here are three interesting Folder Actions to try out.
1. Print files automatically
As much as you may dream of a paperless office, you may still receive documents you need to print. If you only have a single printer and don’t need to tweak settings for different types of documents, you can create a Folder Action that will automatically print any files you add to a folder.
To do this, we’re going to use Apple’s Automator. Launch the Automator applications (it’s in your /Applications folder). When the program opens, select Folder Action in the template sheet that appears and then click Choose.
To the right of the Automator window, above the workflow space, you’ll a line of text that reads: “Folder Action receives files and folders added to.” Click on the Choose Folder menu at the end of the sentence and then select the folder you want to attach this Folder Action to. You may want to create a new folder or just use an existing folder.
Now, click in the search field at the left of the Automator window and type print. A list of Automator actions will appear. Click on the Print Finder Items action and drag it to the right side of the Automator window.
Press Command-S to save this Folder Action and give it a name. Automator will save the Folder Action, attaching it to the selected folder. Now whenever you place a document in this folder, the document will print automatically.
You can check to make sure this works by right-clicking or Control-clicking on that folder and choosing Services > Folder Actions Setup. (If you only have a few Services, you may not have a Services menu and will instead see the Folder Actions Setup menu item at the bottom of the contextual menu.) The dialogue box that displays will show all the folders to which you have attached Folder Actions. When you click on a folder name, you’ll see the Folder Actions assigned to them.
If you select a different folder from the one you used above, then click on the plus-sign (+) button below the right-hand column of the Folder Actions Setup window, you will be able to apply the same folder action you created above to any other folders.
2. Automatically add Spotlight comments
Using Spotlight comments to tag files can help you find them more easily. I use Spotlight comments to add project names to files; when I search for a specific project, such as “MyLatestBook,” it’s easy to find all the files I need.
Chris Breen recently showed how to do this using an Automator workflow. You can do the same thing with a Folder Action created by Automator, as explained above. Check Chris’s article to find how to do this. You might want to set up a number of folders for different projects—each with its own Folder Actions that tags files with Spotlight comments for different projects.
3. Automatically compress files
Need to send or store some big files? You can create a Folder Action that will automatically create compressed archives of files you add to a specific folder. Launch Automator and select Folder Action in the template sheet that appears. Click Choose.
At the top of your empty workflow space, click on the Choose Folder menu and select the folder you want to attach this action to.
From the Library column at the left of the Automator window, click on Files & Folders. Click on Create Archive in the second column and then drag this action to the workflow space to the right of the Automator window. In the Create Archive action, choose where to store the archive. You can choose either Same Folder As Input or a different folder.
Here you can also choose specific names for your archives or leave the name the same as the source file.
Whenever you add individual files or folders to the folder using this Folder Action, the Finder will automatically create archives. Note that if the file or folder is large, it may take a while for the archive to appear.
Make your own Folder Action
If you browse through Automator’s Library, you’ll find many other actions you can use as Folder Actions. Look in the categories for Files & Folders, PDFs and Photos and you’ll find plenty of ways to save time.