Sorting files into subfolders based on tags

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I apologize in advance if this has been answered elsewhere. I have looked earnestly and haven't found a solution that will work in the forum and am hoping one could either answer or direct me to the answer. Here is what I am trying to do:

When I save a file (e.g., MS Word, Powerpoint, etc.) into my Documents folder I'd like to include a project folder specific tag that Hazel sees and does the following:

1) Renames the file, putting the date at the beginning of the name. (I think this is easy and I can do on my own but any tips welcome)

2) Moves the file out of the Downloads folder into the appropriate project folder based on the tag (i.e. if tag=Project ABC, Hazel moves the file into Project ABC subfolder that is a couple of layers deep in the folder hierarchy where all of my Projects are). My hierarchy looks like this: Documents|Projects|Project ABC.

3) If the specific project folder identified by the tag doesn't yet exist, Hazel creates a new folder based on the tag and puts the file into the new folder.

Is this possible?

Many, many thanks in advance for helping save me time and frustration

Bonus points if someone knows a clever way to review a list of existing folders/tags while saving a file so i don't fat finger a tag and end up creating a new project folder that is one letter off from the correct folder, i.e., Project ABD instead of Project ABC. Probably not a Hazel function.
gchamilton
 
Posts: 4
Joined: Mon Aug 17, 2015 1:51 pm

You should be able to do all of those things. You can set up conditions based on tag, and you can use the Sort into subfolder action to put it into a subfolder, creating it as necessary. I say give it a shot and report back with specific problems you run into.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for the reply. I sort of assumed it could be done, I'm actually struggling with the "how". The renaming thing I've figured out, no problem there. It is steps 2 and 3 that I can't quite figure out. Do they need a script or can I just use the tools within Hazel? I should've prefaced my request with the fact that I have zero coding/scripting experience and was really hoping for some more explicit direction, if possible, so I don't have to spend the next year figuring it all out. Anyone else on the forum have some 'plug and play' direction or could point me somewhere where I could find? I'm sure this stuff comes easy to many on this forum but I'm sadly not one of them :|
gchamilton
 
Posts: 4
Joined: Mon Aug 17, 2015 1:51 pm

Can you provide a concrete run through of how a file would go through this workflow? Everything hinges on the specific details.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Sure thing. First, here's my folder hierarchy:

Documents\Projects\Project A, Project B, Project C, etc.

Within each project subfolder there are many files related to that specific project

Here's the intended workflow:

1) I create a new file in, say an MS Excel spreadsheet, and save it to the root Documents folder. When saving the file, I add a tag for the specific project subfolder I want it to end up in. For example, if the file relates to Project A, I add the tag "Project A" during the save dialog and save it to the root Documents folder.

2) Hazel watches the Documents folder and sees that I have saved a new file to the Documents folder. Based on the "Project A" tag it sees in the new file saved in Documents, Hazel renames the file, adding the date to the front end of the file name and then moves it from the Documents root folder into the Project A subfolder.

3) Here's the twist, often, I'll save a file into the Documents root folder with a tag for a project subfolder that doesn't yet exist such as when I am initiating a new project. In that event, I'd like Hazel to create a new project subfolder (at the same level in the hierarchy as all the other project subfolders) using the new tag name I saved the file with as the name of the new folder (e.g., "Project D"). Hazel would then do what it does in step 2) above and moves the new file into the newly created Project D subfolder.

Does that make sense? Again, I surely appreciate any help you can give me.
gchamilton
 
Posts: 4
Joined: Mon Aug 17, 2015 1:51 pm

A couple of important points:

- Do the files have any other tags?
- Are there any tags you might add to the file that you don't want to be interpreted as a directive to sort it into a subfolder?
- If yes to any of the above, is there a distinctive pattern to the tags/project names?
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Great questions I wouldn't have even thought of. Though I'd be really interested in knowing how one might handle multiple tags per file, for my purposes, I'd keep it simple and there would only be one tag per saved file that indicates the sub folder it should go into. So my answer to your questions would be:

- Do the files have any other tags? NO
- Are there any tags you might add to the file that you don't want to be interpreted as a directive to sort it into a subfolder? NO
- If yes to any of the above, is there a distinctive pattern to the tags/project names? N/A
gchamilton
 
Posts: 4
Joined: Mon Aug 17, 2015 1:51 pm

In such a case, you can do a general rule like:
Code: Select all
    If (all) are met
        Tags match (•subfolder tag)
    Do
        Sort into subfolder (•subfolder tag)


where (•subfolder tag) is a custom attribute matching (anything). What that does is capture the first tag into that attribute and then allows you to sort into a folder using that attribute. You'll have to tweak if from there but this should get you started on the right track, hopefully.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support