Page 1 of 1

Process contents in child folder, match on parent

PostPosted: Sun May 30, 2021 4:42 pm
by seasea
Hi
Is it possible to have hazel action on contents in child folder , when I have matched on parent folder?
When I used "run rules on folder contents" it did not work. So I must misunderstand some logic I thought.

The download results in a file structure of the following. I get 20 of these "downloads" a day.

Parent1 name folder (this can be anything)(parent)
Title name (parent2)(can be anything)
Item 1 folder (child) (always named item 1)

The contents (images) are located in child folder, named, "item 1"
The desired action,is, move the images from child folder "item 1l to a processing folder. The move action is simple to do.

However I cannot work out how to get hazel to get to these images. I cannot run rule on "item 1 folder" as They are child folder of my "processing item". I have 20 processing items a day. When I run hazel rule, match on parent folder, hazel assumes contents are within the parent folder. I added action," run rules on folder contents", but it did not work. Result was, hazel ran rule on parent folder and not child folder contents.

I read
https://www.noodlesoft.com/manual/hazel ... ubfolders/
To solve this problem, Hazel offers a special action: “Run rules on folder contents.” If a subfolder inside your monitored folder matches a rule containing this action, then the other rules in the list will also apply to that subfolder’s contents.

Is the rule to move to be within this rule to run rules on folder contents, or am I meant to have 3 rules?

3 rules maybe are:
Rule 1 : pretend contents to be auctioned on (images) are in parent folder 1, action, move to processing folder
Rule 2 : parent p1 add rule that sole purpose is to tell hazel run rule on child eg "action is run rules on folder contents "
Rule 3: repeat rule rule 2 but on parent2 folder

I'm trying to understand logic of this very cool feature

Thankyou for any assistance

Re: Process contents in child folder, match on parent

PostPosted: Mon May 31, 2021 9:41 am
by Mr_Noodle
Can you post the actual rules you have set up?

Re: Process contents in child folder, match on parent

PostPosted: Mon May 31, 2021 3:46 pm
by seasea
Sure
Not sure how to get the image to fit in the post. Apologises right hand side is cut off.

Update:
I managed to get it to work by removing 1 heirachy.


parent folder (combineAUTO)
rule 1: Delete empty folders (must be at top of rule list as rules are hierarchial)
rule 2: Instruct hazel to work on child folders
rule 3: Step 1: Move images to processing folder

Rule 2 and Rule 3 are the rules needed for this task

Rule 2: (screenshot)
Image

Rule 3: (screenshot)
Image


Before I was moving a heirachial folder to Parent folder (combineAUTO)
e.g.
blah parent folder 1 name
title name (parent folder 2)
Item 1 folder (contains the images)

Now I am moving 1 less heirachy, and it worked
title name (parent folder 2)
Item 1 folder (contains the images).

I had done all this effort, hoping Hazel would allow me to move MANY folders to process into combineAUTO
for example (I call these f"older heirachy")
first one
title A name (parent folder 2)
Item 1 folder (contains the images).
second one
title B name (parent folder 2)
Item 1 folder (contains the images).
third one
title C name (parent folder 2)
Item 1 folder (contains the images).
fourth one
title D name (parent folder 2)
Item 1 folder (contains the images).
fifith one
title E name (parent folder 2)
Item 1 folder (contains the images).

There are typically 5 to process.

But I failed. Must have bad logic again... Failed, as Hazel attempts to process next "title B folder hierachy" before finishing the first (title A folder hierachy). The first is processed by another rule on folder "input" e.g. This hazel rule runs a python script to combine the images into a PDF. That script returns the output to this folder combineAUTO (xxx.pdf)

Now I am doing it one by one, but hazel does all the copying of the images at least (so removes some tedious steps).

Re: Process contents in child folder, match on parent

PostPosted: Tue Jun 01, 2021 8:41 am
by Mr_Noodle
It's usually not a good idea to assume the order of processing. You'll need to enforce it yourself. For instance, you can add tags to things to indicate what phase it is in.