Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Hazel - Apply actions to folders based on rules Pick of the Week
The macosxhints Rating:

[Score: 8 out of 10]
[This is the tip of the week for the week of November 13th]

Everyone here is probably familiar with Folder Actions -- Automator actions and AppleScripts can be attached to folders, and they'll run when something in the folder is changed. As a non-programmer, I find the concept intriguing, but I've always stumbled a bit trying to implement just what it is I want to do.

Enter Hazel. Hazel is a System Preferences panel that sort of acts like a global implementer of Folder Actions -- but you can write actions based on simple rules, and you'll never have to touch Automator or AppleScript. You work with Hazel by adding the folder(s) you'd like to a window in the Hazel interface. You then define a rule (or multiple rules) that will apply to items added to that folder. The rules interface is very similar to that of Mail -- choose Any or All as the condition to meet, define the rule(s) that must be met, and then define the action(s) to be taken when those rules are met. You can choose from 14 different rule criteria, including "Date Added," which is just what one needs for the downloads folder, for instance. On the action side, you can do things like copy or move the file, set its label color, add keywords or comments, and run AppleScripts, shell scripts, or Automator actions.

As but one simple example, consider the screenshot at right, which is a portion of my Downloads folder. The orange files are those that are over 10MB in size, and anything blue (just one at this point) has been added to the folder in the last eight hours. This makes it easy for me to keep my window in column view, and yet still quickly identify the largest and newest downloads.

I also have an Installers folder, where I keep local copies of many of the apps I install. Inside the top-level folder, I have a series of alpha folders (A-C, D-G, etc.). Using Hazel, whenever I drop a new installer into the top-level folder, it automatically files itself in the proper subfolder, using a rule built around filename starts with. While not a huge thing, this is a useful timesaver.

Hazel isn't quite perfect -- I've found that the rules sometimes don't seem to "take," especially if you're using the "Run Rules Now" option from within Hazel. But it makes it so easy to add custom actions to folders that I feel it's quite worthy as a Pick of the Week. A free time-limited demo is available to see if you think it's worth $16 -- and yes, you can probably do this all yourself with AppleScript and Folder Actions, but Hazel makes it simple for even those of us with minimal to no AppleScript skills.
    •    
  • Currently 2.42 / 5
  You rated: 3 / 5 (12 votes cast)
 
[19,743 views]  

Hazel - Apply actions to folders based on rules | 2 comments | Create New Account
Click here to return to the 'Hazel - Apply actions to folders based on rules' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Hazel - Apply actions to folders based on rules
Authored by: mtimmsj on Nov 21, '06 08:29:57AM

Just a FYI on folder actions in general. Folder actions don't work on folders that are part of a filevault volume.



[ Reply to This | # ]
A trick for a Download Folder rule
Authored by: AGDenton on Nov 21, '06 09:24:12AM

If you use Hazel for your Downloads folder, you can use it to sycnhronize the "Date Modified" file metadata (which indicates when the host last modified his file) with the "Date Added" timestamp Hazel keeps. This will enable you to sort your downloads by date in the Finder, for instance.
The rule :

If "Date Modified" is before "Date Added"
run shell script "touch"

(you'll have to navigate to /usr/bin to select touch).



[ Reply to This | # ]