Same Conditions For Multiple Folders

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

Moderator: Mr_Noodle

Same Conditions For Multiple Folders Sat Feb 25, 2017 7:51 pm • by jfisher
Hello, I am pretty new to Hazel but enjoy how robust it is.

I am trying to figure out how to create a list of conditions that I can apply to multiple folders and have them moved multiple places.

Basically I only want to have to modify one list of conditions and then have each rule check that file, perform the actions, and move it to whatever folder that specific rule says.

Is there an easy or efficient way to do this?
jfisher
 
Posts: 55
Joined: Sat Feb 25, 2017 7:47 pm

Re: Same Conditions For Multiple Folders Mon Feb 27, 2017 12:10 pm • by Mr_Noodle
Can you give more specifics about the workflow you are trying to achieve?
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Same Conditions For Multiple Folders Tue Feb 28, 2017 7:59 pm • by jfisher
I would like to be able to sort through my downloads folder and sort IMAGES into one folder and VIDEOS files into another.

However, the IMAGES folder and the VIDEOS folder have the same folder structure, (it would be nice if I could sync just the folder structure somehow but that's not as important).

Therefore, I want to apply the same "if name contains" conditions to both folders. I could just copy the rule from one folder to the other each time I make an update but I would like to be able to only have to update one rule and have the other one sync'd. I was thinking that if I had an external AppleScript containing the conditions I could have each Hazel rule reference that AppleScript so I only have to update the conditions in one location. But I really enjoy how Hazel works and how robust it seems to be. Otherwise I would have stumbled my way through a bit of coding.
jfisher
 
Posts: 55
Joined: Sat Feb 25, 2017 7:47 pm

Re: Same Conditions For Multiple Folders Wed Mar 01, 2017 11:48 am • by Mr_Noodle
What you can do is create rules which will move the file to IMAGES or VIDEOS. Use the "Continue" action to have Hazel keep evaluating rules. Then under those, you can have additional rules to sort the file into the proper subfolders. These rules would apply to both images and videos and should allow you to keep the same folder structure using a common set of rules.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Same Conditions For Multiple Folders Thu Mar 02, 2017 1:14 am • by jfisher
I'm not sure I fully understand, "continue evaluating files" is always greyed out?
jfisher
 
Posts: 55
Joined: Sat Feb 25, 2017 7:47 pm

Re: Same Conditions For Multiple Folders Thu Mar 02, 2017 12:04 pm • by Mr_Noodle
Ah right. That's because you can't continue if you move the file away.

What you need to do is instead, have the rule move the files to that folder, then have rules in that folder sort into subfolders. Now, this will result in you having two extra folders to monitor with two sets of rules. What you can do here is use the rule sync feature to sync the rules for the two folders to the same rules file.

If you right click on a folder, you'll see the option to sync rules. Create the rules, then set up sync file for the first folder, then have the second file sync from that file you set up.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Same Conditions For Multiple Folders Fri Mar 24, 2017 11:15 pm • by jfisher
Hello I am back. My other computer died and I had to get a new one. However, am I am back to misunderstanding how Hazel works.

Everything I try to with sort into subfolders seems to create another nested folder that I do not want instead of putting it into a folder that is already there.

I have two rules that monitor a folder called "Unsorted".

Rule 1: Monitors for kind "Images" and moves files to the Images folder.
Rule 2: Monitors for kind "Videos" and moves files to the Videos folder.

I would like the next set of sorting rules to monitor both folders with the same set of criteria. I believe I can get that working with the sync function.

However, I haven't figured out sorting into subfolders. There is no consistency to the files names and therefore would require multiple match criteria? I'm naturally more inclined to use "If name contains "text string" move to this folder. But I believe that falls on its face when you want to sync rules across different folders because you need to specify which folder its going into.

That's where sort into folders comes In, right? It should be able to look through the folder structure and see if the folder exists? However, if I create a token and select that same token when sorting into subfolders Hazel nests the file or folder inside another.

Folder
--->Folder
------>File

How do you get Hazel to recognize the existing folder structure if it exists and move the files into it? I haven't been able to find a good example or tutorial. I'd be very interested in see a product guide if one ever comes out.
jfisher
 
Posts: 55
Joined: Sat Feb 25, 2017 7:47 pm

Re: Same Conditions For Multiple Folders Mon Mar 27, 2017 10:47 am • by Mr_Noodle
Are you sure you aren't matching the folder and filing it into a subfolder? If you do that, then you will end up with the result you are seeing. See the sticky article on going into subfolders. Doing that in conjunction with a rule to move the file should work.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Same Conditions For Multiple Folders Mon Mar 27, 2017 11:46 am • by jfisher
I believe I found the problem or at least a setup that is working right now.

i believe my problem was that I was creating a custom token to try and match part of a file and and then use that same token inside sort into sub folders. That approach would create a folder called "A" and then nest a second folder called "A" inside of it where the file was actually moved to. I had a redundant folder in there I didn't want.

I didn't realize you could just type a folder name into sort into sub folders if you already knew that it existed. I am probably not using Hazel to it's full potential there but it is working.

I've used sort into sub folder instead of just move to folder because I want to sync these rules to a second watched folder "images".

MOVIES
- rule 1 watching movie folder and filtering files containing "text string" into sub folder.
- rule 2 watching the subfolders of MOVIES and moving the files one level down into a sub sub folder based on text string.

I had rule 2 working a few times but when the rules were synced to IMAGES rule 2 had different behaviour that in the MOViES folder. It continually kept nesting the folder one level down and wouldn't stop. I had ten folders before I stopped hazel.

How come the synced rules behave differently?
jfisher
 
Posts: 55
Joined: Sat Feb 25, 2017 7:47 pm

Re: Same Conditions For Multiple Folders Tue Mar 28, 2017 11:22 am • by Mr_Noodle
I'm not fully following the issue about syncing but you need to be wary of having the same file being processed over and over. Especially if you are having Hazel go into subfolders, you need to make sure the rule that is sorting stuff into subfolders doesn't keep matching the files after they have already been sorted.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Same Conditions For Multiple Folders Tue Mar 28, 2017 11:31 am • by jfisher
I believe I've sorted it out now. Used a sub folder depth condition to control how deep it goes. Everything seems to be working as intended.
jfisher
 
Posts: 55
Joined: Sat Feb 25, 2017 7:47 pm


Return to Support