Here it is in the easiest, flexible form. I think this works. You can make this more complex if you want different folder colors for different extensions.
Add the Downloads folder to Hazel.
Then set up the following rules on the Downloads folder in THIS order or it wont work:
1)
If all conditions:
Size is less than 1KB
Then:
Set Color label to blank (the "x")
2)
If all conditions:
Kind is Folder
Then:
Run Rules on Folder contents
3)
If all conditions:
Any File [here instead of Any File you could specify extension types]
Then:
Run Applescript embedded
- Code: Select all
tell application "Finder"
set posix_parent_dir to POSIX path of (container of (item theFile) as text)
end tell
return {hazelSwitchFile:posix_parent_dir}
Set Color label to Red
The first rule basically is looking if the folder is empty - where the size is 0KBs but to be safe i said less than 1KB since i cant imagine you have a file thats small you are downloading. If there is a file in the folder than the rule will be false and move on to rule 2. Rule 2 tells hazel to run the rules on the folders contents. This is how you get Hazel to act on files in folders. The third rule says simply if there is any file present then run he applescript which tells hazel to retarget the parent folder (as opposed to acting on the file in the folder) and the set its color to Red.
Now you could simply just run size rules on folders - if less than 1KB no color if greater than 1KB color Red. However, i set up the rule to allow you to have finer granularity should you want to target certain extension types and set folder colors based on that...your call.
Let me know how it works.