Caught by Hazel endless loop

II got up this morning to a drive filling up with over 100GB of repetitive files thanks to a flaw in my Hazel rules.

I use Hazel to keep a clean computer desktop by moving anything not marked with a sticky tag to another folder (CLEAN DESKtOP) after it has been around for 3 days. The rules used are first:


to ignore tagged items and then:

to move the item to another folder. the To Process tag I use to mark items that I need to look at.

The problem happened with a desktop folder marked as Locked which was not tagged as sticky after upgrading to a new iMac. After three days it tried to move the folder. The way Hazel (and probably the underlying OS) works is to copy the item to the destination and then delete the original. The copy went fine but because the folder is locked it could not delete the original from the desktop. The next time Hazel checks the desktop (which is just a second or so) it sees the folder and tries to move it again. So the drive starts filling up!

I fixed the problem by tagging the item as Sticky prior to the attempt to move. This way if the move fails, it won’t attempt to move it again!

Another method would be to check if “Is Locked” is not true. And, Hazel can be configured to check if an instance of a folder or file exists at the destination location, and skip “move” if true.

Katie

1 Like