I want 2 folders, /1 and /2, where all of their contents (mostly folders with sub-directories) get copied to a third folder, folder /3, where I will deal with the files there and delete them when I'm done. First 2 folders contents remains there as a backup. I want this third folder to show colored tags on every folder within it at the first subfolder depth inside it, one colored tag for stuff that came from folder /1, and another colored tag for stuff that came from folder /2, so I can tell them apart while browsing in folder /3.
For: folder3/contents/subcontents/files
only 'contents' will receive the colored tag.
The catch is that all 3 of these folders need to have a 'run rules on folder contents' within them, because of other rules I have. This is causing issues where every file at every depth level gets a colored tag.
Long version:
I have 3 folders, /1, /2, and /3.
Folders /1 and /2 both get populated with files from a server automatically, not using hazel. Everything that gets put into folders /1 and /2, gets copied to folder /3 using hazel. Here's how I've been doing that:
If all of the following conditions are met:
- Date added is after specific date: 12/16/2022, 4:50 PM
- Copy to folder: 3 (options: copy the folder structure)
Run rules on folder contents
Folder 3 has the following rules:
if all of the following conditions are met:
- any file
- Run shell script: removesync.sh
- Code: Select all
#!/bin/bash
find /Volumes/harddrive/3 -name '.syncthing*' -exec rm -rf {} +
If all of the following conditions are met:
- Kind is Folder
- Run rules on folder contents
The whole point of this setup is that I use folder /3 to see what new additions have been added to /1 and /2. Once I deal with those files in /3, I delete them, while /1 and /2 remain as backups of everything that's been downloaded.
This all works fine, but I'm trying to upgrade these rules to add a colored tag only to files/folders with subfolder depth 0 inside /3. This is so I can see by looking at folder /3, whether a file/folder came from /1 or /2. I don't care if the tags are added inside of /1 and /2, or if they get added when they reach /3. For cleanliness I suppose I'd prefer if it happens at folder /3. Looking at folder /3, I'd like to see files/folders that came from /1 to have a red tag, and files/folders that came from /2 to have a blue tag.
Here's what I've tried:
- 1.) What If I set my rules on folders /1 and /2 to add a color tag while it copies to /3. On folders 1 and 2's rules, I add the option to 'set color label' right between 'copy' and 'run rules on folder contents'. This works ok, but because of my 'run rules on folder contents', it adds a colored tag to everything at every subfolder depth, and copies them to /3.
2.) What if I made a separate rule on /1 and /2 that adds a color tag to any file. On folders 1 and 2, I add a separate rule, take 'any file' and 'set color label'. This will set color labels on the correct folders (subfolder depth 0, everything at the very first level inside /1 and /2), but nothing will copy to /3 for some reason.
3.) What if I set my rules on folders /1 and /2 to add a color tag while it copies to /3, just as I did in example 1, but this time I make a rule on /3 to delete tags on anything greater than subfolder depth 0. On folders 1 and 2's rules, I add the option to 'set color label' right between 'copy' and 'run rules on folder contents, just as I did in example 1. This time I go to /3, and set a new rule: if subfolder depth is greater than 0, remove tags: any existing tags. If I do this, the files will copy properly, but it does not delete any tags on folder /3.
4.) What if I made a new rule on folder /3 that adds a color tag to anything with subfolder depth 0. I make a new rule on /3, any file, subfolder depth is 0, set color label. If I do this, no color labels get set.
I'm running out of ideas here! I think this 'run rules on folder contents' setting on each of my folders is making this difficult to solve. What can I do to accomplish this?
Another idea: Again, my 'run rules on folder contents' setting on /3 is just to remove those pesky .syncthing files. Basically the program I use to copy files from my server, syncthing, will create temporary .syncthing files. Once the files are fully copied, the .syncthing files delete themselves. Without using my removesync.sh script, I end up with these .syncthing files in every subfolder. They get deleted from /1 and /2 automatically by syncthing itself, but during the period where they exist, hazel copies them to /3. Maybe if there was a way to synchronize deletions, I could get rid of my script and therefor remove the 'run rules on folder contents' on /3. This might make it easier to accomplish what I want with color labels. I have looked into the 'synced folders' documentation, the example included is pretty far from what I'm trying to accomplish I think and it's pretty confusing. I don't think I really want to be syncing anyway, because I need to be able to delete files in /3, and have them remain in /1 and /2.
Thanks
