Page 1 of 1

Tagging a Folder that Already Exists Somewhere Else

PostPosted: Tue May 23, 2017 2:39 pm
by TechnologyResearch
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.

Re: Tagging a Folder that Already Exists Somewhere Else

PostPosted: Wed May 24, 2017 11:16 am
by Mr_Noodle
You'll need a script for that as it requires special logic not doable with Hazel's built-in functions.

Re: Tagging a Folder that Already Exists Somewhere Else

PostPosted: Wed May 24, 2017 12:59 pm
by TechnologyResearch
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.

Re: Tagging a Folder that Already Exists Somewhere Else

PostPosted: Thu May 25, 2017 10:47 am
by Mr_Noodle
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.