Add tags by extracting them from the filename

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