Reprocessing/Looping When Sorting To Sub Folder

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

Moderator: Mr_Noodle

Reprocessing/Looping When Sorting To Sub Folder Sun Jan 31, 2016 11:24 am • by jonah
Im new to Hazel and I'm very happy with it so far, but Im having a problem with looping/reprocessing of files when sorting to subfolders.

I would like Hazel to look inside a folder and all of its subfolders (potentially up to 3 levels deep) and sort files into labelled folders within it's enclosing folder. I can get Hazel to look in the folder and it's subfolders, identify the files and sort them; however, endlessly processes the files so I end up with a infinitely deep set of subfolders. I understand that there needs to be something to stop Hazel from looping, but I can't seem to find a way to make this happen.

Any help would be greatly appreciated.

Thanks in advance,
Jonah

My current rules are as follows:

Rule 1
- If ALL of the following conditions is met... KIND is FOLDER
- Run rules on folder contents

Rule 2
- If ALL of the following conditions is met... KIND is PDF
- Sort into subfolder with pattern PDFs


An example of the exiting folder structure that Im would like hazel to process is as follows.

Projects
untitled.pdf
New Project
newproject.pdf
newproject2.pdf

I would like the result to be...

Projects
PDFs
untitled.pdf
New Project
PDFs
newproject.pdf
newproject2.pdf
jonah
 
Posts: 3
Joined: Sun Jan 31, 2016 11:08 am

Look into using the subfolder level attribute to limit where the rule(s) run. Note that the top level is 0.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for the suggestion. Maybe Im not implementing it right, but Ive tried the following and it still is funky.

I can get it to stop with the rule below, but it still generates many nested folders.

If i start with this:

Projects
untitled.pdf
New Project
newproject.pdf
newproject2.pdf

Rule 1
- If ALL of the following conditions is met...
KIND is FOLDER
Subfolder is less than 3
- Run rules on folder contents

Rule 2
- If ALL of the following conditions is met... KIND is PDF
- Sort into subfolder with pattern PDFs

The result is:

Projects
PDFs
PDFs
PDFs
PDFs
untitled.pdf
New Project
PDFs
PDFs
PDFs
newproject.pdf
newproject2.pdf


If I change the sub folder depth commond to "Subfolder is less than 1" I end up with a similar scenario but with fewer nested folders, but it doesn't go any deeper.

Any suggestions?
jonah
 
Posts: 3
Joined: Sun Jan 31, 2016 11:08 am

You want to add the subfolder level condition to the rule which files the PDFs. The way you have it now, it will still dig into the folders you already filed the PDFs into down to 3 levels deep. Instead only have the filing rule match if its specifically at that one folder level.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hmmm. Ive messed around with that and couldn't get it to do what I need. Ive added the subfolder depth command to the rule that sorts the PDFs. But it will only work on folders at the depth that is specified.

Rule 1
- If ALL of the following conditions is met... KIND is FOLDER
- Run rules on folder contents

Rule 2
- If ALL of the following conditions is met...
KIND is PDF
SUBFOLDER DEPTH is 1
- Sort into subfolder with pattern PDFs


I would Hazel to go into all subfolders at any level and if there is a PDF in a subfolder, Hazel will sort them to a folder labeled PDFs within the enclosing folder at that level.

This:

Folder 1 (Level 0)
- Subfolder 1 (Level 1)
-- one.pdf (Level 2)
- two.pdf (Level 1)
- three.pdf (Level 1)

To this:

Folder 1 (Level 0)
- Subfolder 1 (Level 1)
-- PDFs (Level 2)
--- one.pdf (Level 3)
- PDFS (Level 1)
-- two.pdf (Level 1)
-- three.pdf (Level 1)
jonah
 
Posts: 3
Joined: Sun Jan 31, 2016 11:08 am

From your example, it was my impression all the PDFs were at level 1. The point is you don't want to file the PDF's again that are in the PDF folder. You'll have to work out what makes sense for what you want. Subfolder level is one way. Another way is to not go into folders named PDFs but you'll have to figure that out with whatever requirements you have for this.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support