I’m looking for a way for Hazel to copy file into a folder OR create a new folder (set name based on tag) and copy the file into the folder based on the tag of the file.
e.g. I tag a file as “receipt”. Hazel will copy that file into another location and store it inside a folder called “receipt”. If the folder isn’t there, Hazel creates it first, then copy the file into it.
I think you’d need to script this. Hazel could monitor the folder, add the tag, then do the rest with something like AppleScript. It would be nice if Hazel could use tokens to create the folder, but I don’t think a native method exists other than to copy to an existing folder.
No - the part of the discussion I linked to noted that if the folder doesn’t exist, Hazel will create it. I had envisaged you were already looking at using one of the tag tokens; much like @evanfuchs shows in his example rule above.
I guess my biggest issue here was that I was unaware of the availability of the token “tags”, as it’s hidden by default under “other” and I was simply uninspired to check it there. I will follow your instructions to see if I get a good result.
How does the solution I described not address what you are intending to do?
If you create two separate rules, Rule #1 for Folder 1 to copy the file from Folder 1 to Folder 2, and Rule #2 for Folder 2 to sort into subfolders of Folder 2 (Folder 3) based on the file tag, it should work even if Folder 3 already exists.
For example, if you save “File 1” with the tag “work” to Folder 1, Hazel will copy it to Folder 2, then it will move File 1 from Folder 2 to existing /Folder2/work/ or create /Folder2/work/ if it doesn’t already exist.
Sorry I didn’t address the issue directly with you before. I should have done that.
You recommend the pattern tags_name. That creates individual folders for each file name. It does not do what you say it should happen:
“if you save “File 1” with the tag “work” to Folder 1, Hazel will copy it to Folder 2, then it will move File 1 from Folder 2 to existing /Folder2/work/ or create /Folder2/work/ if it doesn’t already exist.”
Your pattern creates folders such as File 1, File 2 (or whatever the file name is). Removing “name” from the pattern also doesn’t help, and I have no clue why. Hazel does not create folders if I remove the “name” pattern. It basically ignores the “tag” pattern.