Color (or tag) folder based on contents

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

Moderator: Mr_Noodle

Color (or tag) folder based on contents Wed Aug 26, 2015 10:23 pm • by stevelucky76
I have a series of folders and am trying to create a rule that scans all those folders and tags them based on the files that they contain. So, for example, if a folder contains any type of image file, I'd like it to get tagged red. If it contains any type of video files, the containing folder gets tagged purple. If it contains both images and videos, it gets tagged both purple and red. I'm assuming I need separate rules for each file type, but I can't for the life of me get this to work. I know all about the rule to run rules on subfolders and am also assuming that it's involved, but that's where I'm stuck. Any ideas?
stevelucky76
 
Posts: 16
Joined: Fri Apr 23, 2010 10:58 pm

Re: Color (or tag) folder based on contents Thu Aug 27, 2015 12:04 pm • by Mr_Noodle
If you want the rules to match and operate on the folders, you do not want to use Run rules on folder contents. Instead, hold down option while clicking the + button to create a new condition. That will create a nested condition. There you will see an extra pop-up with targets like "any of its sub-files" and "all of its sub-files". What that does is allow you to create a rule that matches against a folder based on the files within it. In this nested condition, put the criteria you need to identify the files.

Also, you may need to use the "Continue" action if you want a folder to match multiple rules as by default, they can only match one.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hmmmm. So, something like this?

Image

This doesn't seem to be working. I've also tried to use "all of it's subfiles and folders" as well as "any of it's subfiles and folders". Nothing works. I should mentioned that there are several folders nested 2-3 levels deep. I only want the enclosing folder to receive the tag. Not higher or lower folders. Not sure if that makes a difference or not. What am I missing?
stevelucky76
 
Posts: 16
Joined: Fri Apr 23, 2010 10:58 pm

I'll give you an even better picture about what I'm doing. I'm in video production and have a folder setup that I use for all of my projects. It's a pretty in depth folder structure. Here's kind of what it looks like:

Image

I currently have a rule that runs on all the folders that shows if the folders contain any data. It looks like this:

Image

This way I can see at a glance which folders have data anywhere in them, no matter how deep. SO, what I'm trying to do is create a rule that will show the TYPE of data contained in a folder (images, video, docs, etc...). As I mentioned above, this rule should only tag the containing folder, and not the folders above.
stevelucky76
 
Posts: 16
Joined: Fri Apr 23, 2010 10:58 pm

Re: Color (or tag) folder based on contents Fri Aug 28, 2015 11:15 am • by Mr_Noodle
It's not clear to me which folder you want to tag. In your example, do you want the IMAGE folder to be tagged or the Sample folder? Also, if it is the IMAGE folder, is there a pattern you can use to identify which folders you want tagged. For instance, are they always at the same depth in the hierarchy?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

In this example, I want the IMAGE folder tagged. The folders above it (Sample and ASSESTS) are tagged with another rule that tags them grey. This rule is just to alert me that, "Hey, there's data somewhere in here". I want the IMAGE folder to be tagged to say, "This folder contains images" so it would tag it blue (which is what I use for images). The hierarchy depth changes and there's no consistency there.
stevelucky76
 
Posts: 16
Joined: Fri Apr 23, 2010 10:58 pm

Re: Color (or tag) folder based on contents Mon Aug 31, 2015 11:33 am • by Mr_Noodle
Hmm, this might be a bit tricky without any sort of pattern like subfolder depth or a naming convention. Do the folders that contain images have subfolders themselves? Does the folder only contain images?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Yes, some of them have sub-folders and some of them don't. There really is no pattern to it. On the surface it seems easy. If a folder has images (or documents, movies, etc...), tag it with a specific tag. I'm realizing that it's not so easy to do with Hazel, however...
stevelucky76
 
Posts: 16
Joined: Fri Apr 23, 2010 10:58 pm

Re: Color (or tag) folder based on contents Tue Sep 01, 2015 5:25 pm • by Mr_Noodle
It's not straightforward to me as a human as well :P . If it has subfolders and those folders have something else in them, what color is it supposed to be? There might need to be some sort of precedence system that you need to set up for this to work.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

I sure didn't mean to imply that I thought Hazel was limited. I've got nothing but crazy love for Hazel. :-)

My thoughts were that only the immediate containing folder would get tagged. So, for example. If Folder A contained Folder B which contained Folder C which contained images, only folder C would get tagged as a folder containing images. Does that make more sense?
stevelucky76
 
Posts: 16
Joined: Fri Apr 23, 2010 10:58 pm

Re: Color (or tag) folder based on contents Wed Sep 02, 2015 12:15 pm • by Mr_Noodle
Right. But if you are saying folder C can also contain other folders with stuff, then that complicates things since, at least to me, it seems like folder C can contain some other folder which contains stuff.

You can try doing things like adding conditions saying if it contains a subfolder with a color already, then use a different color. Setting that up carefully you might be able to get what you want.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Yeah, I'll mess around with it. Or maybe I'll just change my tagging scheme entirely to something a little easier. :-)
stevelucky76
 
Posts: 16
Joined: Fri Apr 23, 2010 10:58 pm

Re: Color (or tag) folder based on contents Mon Feb 29, 2016 8:56 pm • by Rhys
Hi I was trying to do something similar and got a result that I think you want
Image
how to screen capture
Rhys
 
Posts: 4
Joined: Sun Jul 26, 2015 6:03 pm


Return to Support