Folder Actions

Folder actions are scripts that you can attach to folders in the Finder. These act on all items you add to these "hot folders." When you add items, the operating system detects the added files and runs any folder actions attached to the folder.

The actions supplied by DEVONthink are installed in ~/Library/Scripts/Folder Action Scripts, and you can add your own scripts to this directory, as needed. For everyday use and exploration, here are the folder action scripts provided by DEVONthink:

These built-in actions also include this line to run an available smart rule on imported or indexed items: perform smart rule record theRecord trigger import event. You can enter the name of a specific smart rule in your own scripts, as needed.

This built-in action include this line to run an available smart rule after OCR has finished: perform smart rule record theRecord trigger OCR event. You can enter the name of a specific smart rule in your own scripts, as needed.

Attaching a folder action

To attach a folder action script to a folder, do the following:

Manage folder actions: To manage all your folder actions, Control-click a folder and choose Services > Folder Actions Setup from the context menu. Use the Folder Actions Setup utility to see which folders have scripts attached, and to remove folder actions from folders.

Terminology

While we can't provide specific training on how to create folder actions, check out Apple's documentation. However, the on adding folder items to folderVariable after receiving filesVariable is the handler most commonly used in our folder action scripts. Here is a simple example:

Folder actions, like any computer processes, are treated very literally. When processing files with a folder action, it's best to move or delete the files from the watched folder. This keeps the action from trying to reprocess files.

Also, while folder actions can still be a useful option, many can be replaced by indexing a Finder folder and processing their contents with smart rules. You can use the Move into Database action to import the document into your database, keeping the Finder folder clean for subsequent additions.