Page 1 of 1

Strange behavior on local Dropbox folder

PostPosted: Thu Aug 14, 2025 1:15 pm
by ollik
My Hazel Rule runs on ~/Cloudstorage/Dropbox/Projects
In the projects folder are different folders for each project. Each may have other subfolders.

First rule:
Locate all sub folders

If ALL of the following conditions are met

Kind is Folder

Do the following:
Run rules on folder contents
Continue matching rules

(WORKS)

Second Rule
Prevent Dropbox sync of Auto-Backup Folders
Some folders may contain Auto-Backup Folders. This script prevents the auto backup of those folders.

If all of the following conditions are met

Name is auto-backups

Do the following

Run shell script embedded script /bin/sh
xattr -w 'com.apple.fileprovider.ignore#P' 1 "$1"

Set color label orange.

(WORKS)

Third rule: Mark and move folders

If at least one file in the folder is younger than 14 days, the folder is considered "in progress". If not, the folder is
considered a legacy folder and should be moved.


If all conditions are met
Passes shell script embedded script /bin/zsh

RECENT_FILES=$(find "$1" -type f -mtime -14 -print -quit)
if [ -z "$RECENT_FILES" ]; then
exit 0
fi
exit 1

Subfolder Depth is 0

Do the following matched file or folder

Set color label "red".
Now: The idea would be to use the move command to Move the legacy folders into folder "Project Legacy". The "age" of the folder is correctly identified and set to red. However, moving does not work.

Then I Tried "Sync into folder "Project Legacy"". This does work.

Then: Move to folder "Trash". The folders are gone, but not in the Trash. Why?

I don't know why the folder content is not moved (I have piped the output from Hazel which contains the correct path and the mv command works. When using "MOVE" or an embedded script

mv -v "$1" "~/Documents/Projects\ Legacy/." 2>&1 >> ~/Documents/test.log

the command is not executed at all, no output in test.log
when using echo, the current path is written to test.log, using the mv command, it works perfectly.

What is curious, that the moving to trash command does not work properly, so I am concerned that my script is somehow shady,
although the moving itself via sync seems to work.

Sorry for the long post, but I really don't know how to proceed-

Best regards,
Oliver

Re: Strange behavior on local Dropbox folder

PostPosted: Fri Aug 15, 2025 8:51 am
by Mr_Noodle
Note that you probably don't need to use scripts for many of those functions. See nested conditions in the manual, for instance.

I'm still not clear what you are trying to do. In your third rule, you are matching a folder that has legacy folders. Note that the rule as a whole still operates on that folder and not those subfolders so if it matches, the whole top level folder is moved. Not sure if this is the intent.

I suggest going through the troubleshooting guide here: https://www.noodlesoft.com/kb/hazel-tro ... ing-guide/

Report back with the results of each test.

Re: Strange behavior on local Dropbox folder

PostPosted: Sun Aug 17, 2025 4:42 pm
by ollik
Thank you very much for your answer! I have now completed the task without a dedicated script as the nested conditions work perfectly. :)

I have checked the same script with a local folder - and it works perfectly. Some commands do not seem to work with Dropbox folders, e.g. moving does not work, instead I have synced and then moved to trash - even if this moving just moves it out of the Dropbox and it never lands in the trash....

Re: Strange behavior on local Dropbox folder

PostPosted: Mon Aug 18, 2025 10:15 am
by Mr_Noodle
Can you post/email the errors you get when trying to move the files?