Page 1 of 2
Concerning Hazel and iCloud

Posted:
Sun Feb 23, 2025 1:32 am
by klind
Two questions:
(1) I would like to use Hazel on my documents folder. That should be easy and simple, but having set my documents folder to sync at iCloud in order to have the documents available everywhere, the Home/Documents is now hidden. So what is better; 1) Set Hazel to use the iCloud/Documents folder, or 2) Set hazel to see hidden folders and then use the Home/Documents folder and what are the pros and cons of each?
(2) Various macOS apps automatically save files to different iCloud sub-folders such as Documents, TextEdit, Shortcuts, Script Editor, etc. I would like to get Hazel to automate moving files found in these sub-folders to the iCloud/Documents solder then sorted by kind and the empty sub-folder deleted. Is this possible and what would the Hazel rule look like?
Re: Concerning Hazel and iCloud

Posted:
Mon Feb 24, 2025 9:40 am
by Mr_Noodle
Documents should not be hidden. Are you sure there isn't something else doing that?
As for subfolders, there's a chapter on handling that in the help but proceed with caution. Doing that over all your iCloud files can potentially be dangerous.
Re: Concerning Hazel and iCloud

Posted:
Tue Feb 25, 2025 1:15 am
by klind
Hmmmmm... Not sure if we are on the same page. I am using macOS Sequoia 15.3.1. When I go into System Settings >Apple ID >See All >iCloud Drive and select the option 'Desktop & Documents Folders' those folders become visible in the Finder iCloud Drive and hidden in the Home folder. Hence my question concerning how to best make copies of files contained in the Documents folder.
But OK, let's let that pass for now. Perhaps it be easier to simply ask for some constructive guidance with a rule with which I am have some small bit of trouble. I want to copy files contained in a particular folder from the managed folder to a folder in an attached volume, but at the same time I want to not copy files that are contained in one sub-folder of that managed folder. I have tried several things, but I am kind of confused and not getting there.
The two rules simplified are like this:
- Code: Select all
Process Sub Directories
If all
Kind is folder
Run rules on folder contents
Copy All Files
If all
If none of any of its subfiles or subfolders
Kind is Folder
Name is XXX
Kind is not folder
Copy to folder NNN (from monitored folder)
I've tried the second rule several ways without success. What I want to do is copy everything in the monitored folder except all the stuff that happens to be in the monitored subfolder XXX.
How can I get Hazel to copy everything except one subfolder?
Re: Concerning Hazel and iCloud

Posted:
Tue Feb 25, 2025 9:32 am
by Mr_Noodle
Do you want to copy the files or the folder containing the files? That's a big detail.
Your second rule does not make sense in that it is using a nested condition matching on subfiles. That implies that it's trying to match a folder, while the next condition matches not a folder.
Re: Concerning Hazel and iCloud

Posted:
Thu Feb 27, 2025 4:25 pm
by klind
Not sure how to answer more clearly.
Concerning the second rule, this is just one iteration of what I have tried.
Let me try this. Suppose I have the following folder structure:
aaaa
bbbb
cccc
dddd
eeee
ffff
gggg
hhhh
Now I want to copy everything contained in aaaa including folder structure, except the folder and contents of sub-folder cccc which should not be copied, just left alone as is.
I'm absolutely sure Hazel can do this, I just can't seem to get my head around it.
Thanx...
Re: Concerning Hazel and iCloud

Posted:
Fri Feb 28, 2025 11:31 am
by Mr_Noodle
Can you post what the results look like?
Re: Concerning Hazel and iCloud

Posted:
Sat Mar 01, 2025 5:57 pm
by klind
I'm sorry. The description I provided didn't post correctly. Here it is again:
- Code: Select all
aaaa
bbbb
cccc
dddd
eeee
ffff
gggg
hhhh
Given this I want to copy everything in folder aaaa except the folder and contents of folder bbbb. So the result would be the following on a new empty folder on a sparate drive:
- Code: Select all
aaaa
dddd
eeee
ffff
gggg
Sorry for the confusion... My fault.
Re: Concerning Hazel and iCloud

Posted:
Mon Mar 03, 2025 9:33 am
by Mr_Noodle
If you are monitoring the folder containing folder "aaaa", then you would want a couple of rules:
1) one to go into folder "aaaa". Check the chapter on subfolders in the manual.
2) one to copy a folder unless it is named "bbbb". Set the option in the Copy action to copy over folder structure.
Re: Concerning Hazel and iCloud

Posted:
Mon Mar 03, 2025 9:59 pm
by klind
I'm sorry. The description I provided didn't post correctly. Here it is again:
- Code: Select all
aaaa
bbbb
cccc
dddd
eeee
ffff
gggg
hhhh
Given this I want to copy everything in folder aaaa except the folder and contents of folder bbbb. So the result would be the following on a new empty folder on a sparate drive:
- Code: Select all
aaaa
dddd
eeee
ffff
gggg
Sorry for the confusion... My fault.
Re: Concerning Hazel and iCloud

Posted:
Mon Mar 03, 2025 10:31 pm
by klind
I am not monitoring the folder containing aaaa, I am monitoring the folder aaaa itself and I want to copy everything in folder aaaa, except one sub-folder of aaaa. So I have the rule:
- Code: Select all
Process Sub Directories
If all
Kind is folder
Run rules on folder contents
Applied to folder aaaa and that copies everything. But I want everything except one sub-folder and all of its contents including sub-folders of that particular sub-folder.
I can do this:
- Code: Select all
Process Sub Directories
If all
Kind is folder
Name is not bbbb
Run rules on folder contents
But then some of the sub-folders of bbbb get messed up.
Re: Concerning Hazel and iCloud

Posted:
Mon Mar 03, 2025 10:54 pm
by klind
Seems I need to revert back to my original question, being:
(1) I would like to use Hazel on my documents folder. That should be easy and simple, but having set my documents folder to sync at iCloud in order to have the documents available everywhere, the Home/Documents is now hidden. So what is better; 1) Set Hazel to use the iCloud/Documents folder, or 2) Set hazel to see hidden folders and then use the Home/Documents folder and what are the pros and cons of each?
In testing, I have created a simple rule to sort level 0 files into sub-folders by kind. Applying that rule to the Home/Documents folder does not work... nothing gets sorted unless I choose to not apply the macOS setting to not send Desktop & Documents folders to iCloud. I need Desktop & Documents in iCloud so as to have Documents available on my other systems. But I still want to make other copies of the Documents folder. However, apparently Hazel sees the Home/Documents folder as hidden, so the rules don't work. At the same time if I try to use Hazel on iCloud/Documents other problems occur.
Perhaps you might consider adjusting the Hazel programming to function by default on the Home/Documents folder regardless of it possibly being hidden in the user's Home macOS account.
Re: Concerning Hazel and iCloud

Posted:
Tue Mar 04, 2025 9:45 am
by Mr_Noodle
Again, I don't think your Documents folder should be hidden. Is Documents in your sidebar in Finder?
Re: Concerning Hazel and iCloud

Posted:
Tue Mar 04, 2025 9:36 pm
by klind
Yes, under iCloud... But not visible under my home folder kenlind.
Re: Concerning Hazel and iCloud

Posted:
Wed Mar 05, 2025 9:32 am
by Mr_Noodle
You can't add the folder from under iCloud to Hazel?
Re: Concerning Hazel and iCloud

Posted:
Wed Mar 05, 2025 4:34 pm
by klind
Cloud storage is a bit flakey. Sometimes basic operations will fail with cryptic errors. Sometimes files are not moved where I want. It seems to vary. Also, when I first tried I lost some files. Not directly because of Hazel, but because things didn't work as I thought they would and I then made mistakes myself that caused the loss.
All I really want to do is copy everything in a given folder except one sub-folder and all of its contents. To me this seems doable with Hazel. I just cannot get it figured out.