Can hazel use a unique part of a folder name as a tag for all subfolders?

First, I’m not sure if I should put this in software or tech support :slight_smile:

I’m working on a system for project file management.

My project folder looks like this


The first rule I’ve got hazel to run is to rename any new folder that is put into this projects folder with a new project number that is generated by hazel. Like this:


This is the rule I use for that:

What I’m trying to do now, but having problems with is applying a tag on all documents that are put in any of the folders or subfolders.

So any file that is put in the folder “(PE0433) - A” would automatically get the tag (PE0433). For example, the text file “A2.txt” from the second picture would get the tag (PE0433).

I don’t have any problems applying other tags to the subfolder, the problem is specifically:

Is there a way to capture the project number(PE0000) from the main project folder and add it as a tag?

Have you tried applescripting it?

No, I’m still very new to AppleScript and I would not know where to begin!

But, I managed to solve it!

This is how I constructed it!




Hope It helps someone in 10 years!

Courtesy search terms : #Hazel #Subfolders #Tags #Tags in subfolders