Add tags by extracting them from the filename

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

Moderator: Mr_Noodle

Add tags by extracting them from the filename Wed Jan 29, 2020 2:02 pm • by prokher
Dear All,

I would like to automatically set tags to files and folders by extracting them from filenames. For example folder with a name "SomeDirName [#tag1 #tag2]" shall have two tags "tag1" and "tag2". Files in this folder should also have this tags.

I spent couple of hours playing with Hazel settings and reading the documentation, but for me it is still unclear is it possible to setup such rule or not.

Thanks in advance!
prokher
 
Posts: 2
Joined: Wed Jan 29, 2020 10:56 am

Look up "match patterns" in the manual. Using those, you can create custom attributes to match the tags in the filename. You can then use those attributes in a dynamic tag. Note that this will only really work for a fixed number of tags.
Mr_Noodle
Site Admin
 
Posts: 8523
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thank you for the response. The idea is that the number of "tags" in the filename is indeed unknown in advance.
prokher
 
Posts: 2
Joined: Wed Jan 29, 2020 10:56 am

Unless there's a cap on the number, you may need to write a script to do that part.
Mr_Noodle
Site Admin
 
Posts: 8523
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support