Page 1 of 1

Add tags by extracting them from the filename

PostPosted: 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!

Re: Add tags by extracting them from the filename

PostPosted: Thu Jan 30, 2020 11:54 am
by Mr_Noodle
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.

Re: Add tags by extracting them from the filename

PostPosted: Mon Feb 10, 2020 12:01 pm
by prokher
Thank you for the response. The idea is that the number of "tags" in the filename is indeed unknown in advance.

Re: Add tags by extracting them from the filename

PostPosted: Mon Feb 10, 2020 12:28 pm
by Mr_Noodle
Unless there's a cap on the number, you may need to write a script to do that part.