Filer's Rule-Making Reference
Rule Conditions — Rule Actions — Substitutions
Common Attribute Names — Example Rules
You will probably find most parts of the Filer pretty self-explanatory, please refer to Filer's User Documentation for more information.
To really get power out of it, you'll want to read the information below, though. There are also a number of useful examples to get you going.
You will need at least one condition for the rule to test for. It can be the type of file, something about its name, how big it is, or some other attribute. These other attributes can be things like someone's nickname kept in a Person file or the e-mail address in the To: field of an e-mail. Note that these can appear on just about any kind of file, but generally will only be found on the kind of file you expect it to be on. A rule will only match if all the conditions you set are met.
If the conditions are met, the Filer will perform a series of actions that you choose. Actions can be chained together, such as renaming a file and then moving it to another folder.
Move it to… | Move a file to the folder entered in the text field. | |
Copy it to… | Copy a file to the folder entered in the text field. | |
Rename it to… | Rename the file. | |
Move it to the Trash | For those files which you no longer want. | |
Delete it | Only if you're sure of yourself and hate a cluttered Trash can. | |
Terminal command… | For experts. Run a command just as if you typed it into a Terminal. Substitutions (see below) are performed before the command is executed. This can make the Filer automatically do all sorts of things it couldn't do otherwise. If you move or rename the file this way, you'll need to do everything else with more Terminal command actions or a shell script. |
You can also substitute certain information about the file into the text box for an action. For example: %TIME% is replaced with the current time before the action is performed. Here are all the possible choices:
%FILENAME% | Full name of the file being processed. | |
%EXTENSION% | Just the extension of the file, as in .txt in MyTextFile.txt or .tar.gz in MyArchive.tar.gz. | |
%BASENAME% | File name without extension, like MyTextFile in MyTextFile.txt. | |
%FOLDER% | Full location of the folder which contains the file, like /boot/home/Videos for /boot/home/Videos/HaikuRocks.wmv. | |
%FULLPATH% | Full location of the file, such as /boot/home/config/MyFavoriteSong.mp3. You'll need this for "Terminal Command" actions. | |
%DATE% | Current date in the format MM-DD-YYYY. | |
%EURODATE% | Current date in the format DD-MM-YYYY. | |
%REVERSEDATE% | Current date in the format YYYY-MM-DD. This is often useful for file archives or for pictures. | |
%TIME% | Current time using 24-hour time. | |
%ATTR:xxxx% | An extended attribute of the file. The technical name for the attribute is put between the colon and the second %. At this point, unfortunately, the case-sensitive, technical name of the attribute must be used. For example, an e-mail address attribute is META:email. This can be found in the FileTypes preferences application by choosing the type of file it is normally found on and double-clicking on it in the "Extra attributes" box. In the window that appears, it will be in the box marked "Internal name". |
Here's a list of some common attibutes. Consult the FileTypes preferences if you look for the attribute name of a specific file type.
Attribute name | ||
E-mail address | MAIL:email | |
E-mail subject | MAIL:subject | |
E-mail recipient | MAIL:to | |
E-mail sender | MAIL:from | |
E-Mail spam/genuine | MAIL:classification | |
Nickname | META:nickname | |
Street address | META:address | |
MP3 artist | Audio:Artist | |
MP3 album | Audio:Album | |
MP3 track name | Audio:Title | |
Program category | META:category |
Move all e-mails on the MyAccount account to its own folder in the mail folder:
When: | Email:Account | is | MyAccount | |||
Do: | Move it to… | /boot/home/mail/MyAccount |
Sort JPEG photos by date into their own folder in /boot/home/Pictures:
When: | Type | is | image/jpeg | |||
Do: | Rename it to… | Photo %TIME%.jpg | ||||
Move it to… | /boot/home/Pictures/%DATE% |
Make sure that MP3s have searchable attributes using Axel Dörfler's excellent id3attr program, rename them to "ArtistName - SongName.mp3", and sort them in the /boot/home/music folder by the artist's name. This would make importing an MP3 collection from somewhere else very easy.
When: | Name | ends with | .mp3 | |||
Do: | Terminal command… | id3attr '%FULLPATH%' | ||||
Rename it to… | %ATTR:Audio:Artist% - %ATTR:Audio:Title%.mp3 | |||||
Move it to… | /boot/home/music/%ATTR:Audio:Artist% |
Extract Zip archives to the Desktop and dump them into the Trash for later disposal:
When: | Name | ends with | .zip | ||||
Do: | Terminal command… | unzip %FULLPATH% -d boot/home/Desktop | |||||
Move it to the Trash |