Add Tag to parent folder If subfolder title contains "xxx" in the title

check this thread:

and you can use the Set File Attribute for tags