Create folder based on file tag

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

Moderator: Mr_Noodle

Create folder based on file tag Wed Aug 12, 2020 5:08 am • by Bernardo
I'm trying to accomplish the following with Hazel:

Folder 1 contains tagged files

Hazel copies all of the tagged files into another drive, into folder 2. Inside Folder 2 Hazel will create folders (folder 3) having as name only the tag of the file.

Example:

Folder 1 contains ten files tagged as work
Hazel copies all ten files to Folder 2, create a folder called work (Folder 3) and add all the ten files into it.
If the folder work (Folder 3) already exists in the destination, all new files tagged as work in Folder 1 are moved into Folder 3.

Anyone?
Bernardo
 
Posts: 7
Joined: Tue Aug 11, 2020 11:58 am

Re: Create folder based on file tag Wed Aug 12, 2020 9:58 am • by Mr_Noodle
Are there other tags on the file or just one? You should be able to use the Sort into Subfolder action for this though depending on the answer to that question, there may be complications.
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Create folder based on file tag Wed Aug 12, 2020 10:14 am • by Bernardo
Some files are associated with more than one tag, some with a single tag only. I've done tests with one tag files exclusively, and it failed.

Setup is:

If / /all / Tags is not blank

Do the following...

Copy to folder X
Sort into subfolder with pattern / tags

Note that folder X is stored in iCloud.
Bernardo
 
Posts: 7
Joined: Tue Aug 11, 2020 11:58 am

Re: Create folder based on file tag Thu Aug 13, 2020 9:50 am • by Mr_Noodle
How is it failing? Is it failing in the copy step or sort into subfolder step? Have you checked the logs?
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Create folder based on file tag Mon Aug 17, 2020 11:57 am • by Bernardo
Mr_Noodle wrote:How is it failing? Is it failing in the copy step or sort into subfolder step? Have you checked the logs?


Sorry for the delayed response. It says that source and destination are the same. But that's strange, if I want to sort into a subfolder, why this problem appears?
Bernardo
 
Posts: 7
Joined: Tue Aug 11, 2020 11:58 am

Re: Create folder based on file tag Mon Aug 17, 2020 12:01 pm • by Bernardo
If I use any other pattern than "tags", the folder creation ensues. It seems like "tags" is not an accepted pattern for folder creation. Am I right?
Bernardo
 
Posts: 7
Joined: Tue Aug 11, 2020 11:58 am

Re: Create folder based on file tag Tue Aug 18, 2020 11:08 am • by Mr_Noodle
Looks like we've been discussing this via email so we'll just continue there.
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Create folder based on file tag Wed Jul 21, 2021 6:19 am • by JDogg016
Hi All,

I have the same exact issue where a rule eventually tries to sort a file into a subfolder with the pattern 'tags'. This rule fails as 'the source and destination folder are the same'. Any reason why?
JDogg016
 
Posts: 3
Joined: Sun Mar 06, 2016 9:26 am

Re: Create folder based on file tag Wed Jul 21, 2021 9:41 am • by Mr_Noodle
Can you provide more details? A screenshot of your rule as well as an example file and what tags it has?
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Create folder based on file tag Mon Jul 26, 2021 7:21 am • by AgentBadger
Hi, I am trying to do something very similar.

I have tags pdf docs I want the file into certain folders based on tags, each PDF might have several tags and I want to make a copy in a folder for each tag. File tags have the format 'Donor PR XXXX' with the donor or standard across all this tag group. I want to remain a master copy of the PDF in the folder '1. Press release'.

Ideally I'd like to add the tags in my download file, adding each donor tag first before filing to the main '1. press release' folder, once in the main folder I'd like Hazel to automatically then copy into the multiple donor folders.

As an extra bonus of I create a new tag starting with 'Donor PR' that does not already exist, if Hazel could generate a new donor pr folder in the same root director as the others that would be great.

Thank you for any advice.
AgentBadger
 
Posts: 2
Joined: Mon Jul 26, 2021 6:59 am

Re: Create folder based on file tag Mon Jul 26, 2021 10:20 am • by Mr_Noodle
Is there a fixed list of possible tags or can the tags be anything? Except for a limited case like that, you may need to write a script to do that type of logic.
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Create folder based on file tag Mon Jul 26, 2021 10:50 am • by AgentBadger
Mr_Noodle wrote:Is there a fixed list of possible tags or can the tags be anything? Except for a limited case like that, you may need to write a script to do that type of logic.


Tags are on a flexible list in that new donors might be added etc in the future. I am starting each tag with 'Donor PR' with the second part of the tag name flexible ABC etc. Each PDF will likely have a different combination of the donor tags that I need to apply.

Thank you
AgentBadger
 
Posts: 2
Joined: Mon Jul 26, 2021 6:59 am

Re: Create folder based on file tag Tue Jul 27, 2021 8:33 am • by Mr_Noodle
If there are multiple donor tags per file, you may require a script. There's no good way to control which item in a list you can match or to handle multiple matches.
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Create folder based on file tag Wed Sep 08, 2021 6:31 am • by eilskov
hi, I have a similar problem, but only when I apply the rules to network drives. Maybe this can give some input to how to solve it. I don't want to hijack this thread at all.

My setup is as follows:

I add two tags to each file. The first tag is a more general tag: Company, Private or Other
This then guides each files to a corresponding folder (on a network drive), where I want to sort the files into subfolders depending on the last tag of the two tags (I always tag the files in this order). I get the same source and destination error, since it seems that the sort into tag variable is empty. It triggers ok, but the sort into cannot see the tag value.

I have done the exact same thing for several year on a local drive with any issues. Is there a way to check if this tag is indeed empty?
eilskov
 
Posts: 6
Joined: Wed Sep 08, 2021 6:20 am

Re: Create folder based on file tag Wed Sep 08, 2021 8:50 am • by Mr_Noodle
Can you post the rule?
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Next

Return to Support