Page 1 of 1

How to transfer folder name to all of its subfiles/subfolder

PostPosted: Thu Mar 21, 2019 12:43 pm
by NilsMorten
Folders with unique names are copied to the root of my monitored folder. How can Hazel transfer the unique folder name for each folder to all of its underlying sub elements as a tag or comment?

Kind regrads Nils

Re: How to transfer folder name to all of its subfiles/subfo

PostPosted: Fri Mar 22, 2019 10:47 am
by Mr_Noodle
This might be a bit tricky. First off, here's how you can grab the name of the parent folder:
Code: Select all
  If (all) are met
      Subfolder level is 1
      If (all) are met for (the enclosing folder)
          Name matches (• folder name)

See the manual for "nested conditions" if you don't know what those are. (• folder name) is a custom attribute (look it up if you are unfamiliar) set to match "anything". What this does is grab the parent folder's name which you can then re-use in other actions, like setting a tag or comment.

Now this would only be appropriate for items directly under the folder, thus subfolder level 1. The folders themselves reside at level 0.

For items further down, you can try a rule which checks the enclosing folder and see if it has a tag, and set that on itself. This would probably require that there are no other tags or comments, unless you use some sort of formatting scheme to set them apart.