How to make files inherit tags from parent folder?

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

Moderator: Mr_Noodle

I've looked through the documentation and browsed through the forum, but haven't found answer so I'm posting here for help. My problem is I have a parent folder with subfolders A, B, C, and inside these folders are files. The problem here is that I will add new subfolders all the time so next week there might be subfolder D, E, F added. This means I don't know the name of the subfolders ahead of time. What I want to do is make the files inside one of these subfolders inherit the tags of the subfolder. So if subfolder D is tagged with "Tag for folder D", then I want all the files and folders under subfolder D to also have this tag.

The hurdle I'm facing is ... I don't know have to get the attribute "tags of parent folder" in order to add those tags to all contents inside the subfolder. Maybe Hazel is not a suitable tool for this? Any guidance will help.

Thanks.
Atlas
 
Posts: 6
Joined: Thu Mar 17, 2022 7:30 pm

Is there only one tag or did you want all tags inherited?
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for helping. Ultimately, I would like the all files inside a subfolder to inherit all tags from its parent folder. Suppose for example, I have a file "foo" in folder A and file "bar" in folder B, which is under folder A. Then I would like file "foo" to have "all tags of folder A", and for file "bar" to have "all tags of folder A and folder B".

Essentially, I would like files to inherit tags from parent folders. Well ... what I really want is for a file to inherit the comments metadata of the parent folder, but I figured phrasing it as tags would be easier for the community to address; and whatever method for tags would work for comments metadata as well.

Thanks again for helping, because I've already spent hours trying to make this work.
Atlas
 
Posts: 6
Joined: Thu Mar 17, 2022 7:30 pm

No way to do that now short of writing a script to transfer the tags for you. Problem is that there's no mechanism in Hazel at the moment to hold a list of items which can later be applied. It is something being considered for a future release.

Note that you can do this for comments since they are a singular piece of data, not a list. You can use a nested condition in conjunction with a custom text attribute to match the comment on the parent. Search the forums for nested condition as this type of thing has been answered many times.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for giving your thoughts on this. Perhaps Hazel is not a suitable tool for using tags in the way I need, and I appreciate you saving me the time. But I'm still interested in using it for comments, and I have the following question:

1. I've looked up this question previously in the forum, and I don't see how nested conditions can help me. The hard part is "how do I get fetch the comments of a given parent folder?". I don't know the name of the subfolder before hand, and I don't know their comments. So how I can I tell Hazel which comments to add to the children files of subfolders?
2. Do I need to resort to running a script to fetch the comments metadata of the parent folder?

Perhaps the answer is too obvious and I'm wasting everyone's time with the question. You've been helpful enough, and if you feel the question is already adequately answered, further guidance is not required. Thanks.
Atlas
 
Posts: 6
Joined: Thu Mar 17, 2022 7:30 pm

If you look at a nested condition, you will see an option for "its enclosing folder". You can set that and any subconditions of that nested condition will apply to the parent folder. You can then use a match pattern with a custom text attribute to grab the comment. Then in the comment action, you can use that custom attribute you created (which contains the parent's comment).
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thank you very much for the more detailed guidance. I think I see where you're going. I will need to run a script to create a custom text attribute, as you described.

Well ... in theory, if the method works with comments as a string, I imagine someone can use this same method on tags, as long as they can convert the tag list into a string.
Atlas
 
Posts: 6
Joined: Thu Mar 17, 2022 7:30 pm


Return to Support

cron