Tagging a Folder that Already Exists Somewhere Else

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I am working on a project that causes me to use a Folder "/Volume-1/C" and I want to know any time a directory is created there whether it -already exists- elsewhere, in "/Volume-2/A/B" location.

If the Folder exists in the trigger Folder "C" but not in "B", I want to tag the directory in Folder "C" with a Yellow tag. If the Folder does -not- exist in "B", I want to make it a Green tag.

I read the Sync Folders example, but don't understand how I might apply that general pattern, but I suspect that's the one.

Thank you.

/Volume-1/C/Apples
/Volume-1/C/Oranges
/Volume-1/C/Pears

/Volumes-2/A/B/Pears

Apples and Oranges Folders would be Tag Green, and Pears would be Tag Yellow.
TechnologyResearch
 
Posts: 2
Joined: Tue May 23, 2017 1:17 pm

You'll need a script for that as it requires special logic not doable with Hazel's built-in functions.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:You'll need a script for that as it requires special logic not doable with Hazel's built-in functions.


I thought that might be the answer. I can script when I have to script. What would the script need to return: 0 or 1 for false and true? Or does the script do more than tell Hazel the true/false of the rule (?) that calls it?

This wold be a titanic time-saver for me, so I'm willing to do a lot. I assume UNIX shell would be okay, but if I need to do something else, I'm game.

Thank you.
TechnologyResearch
 
Posts: 2
Joined: Tue May 23, 2017 1:17 pm

This chapter should tell you want you need to know for shell scripts: https://www.noodlesoft.com/manual/hazel ... l-scripts/

You'd want to use a script in a condition but, to align with UNIX shell scripting rules, 0 would be true (it is used to indicate no errors) and anything else would be interpreted as false.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support