Detect when content is deleted from a folder

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

Moderator: Mr_Noodle

I am trying to automatically back up my Arc browser extensions, since the functionality isn't built into the browser. My plan was to have Hazel monitor the ~/Library/Application Support/Arc/User Data/Default/Extensions folder for changes, and then run a Python script that will create a list of all my extensions in JSON format.

The problem I am running into is that my rule is triggered just fine whenever a subfolder is added to Extensions, but not when it is removed. I tried creating a rule that should be triggered when any of the following conditions are met:
- Any File
- Date Last Modified -> did change
- Size -> did change
- Sub-file/folder Count -> did change

To verify that the issue wasn't specifically with this folder, I tried to set up the a rule with the same conditions in my Documents folder, and the result is always the same: if I add a folder (or file), the rule is triggered; if I delete a folder (or file), the rule isn't triggered.

This is what I see in my logs when I add and then remove a file from the test folder:
Code: Select all
2024-09-28 16:12:10.596 hazelworker[19607] Running worker (v5.3.4) for folder with identifier: 16777231-93486578.
2024-09-28 16:12:10.597 hazelworker[19607] ###Arch: arm64
2024-09-28 16:12:10.597 hazelworker[19607] ###main load address: 0x102578000
2024-09-28 16:12:10.597 hazelworker[19607] ###Hazel Core load address: 0x102748000
2024-09-28 16:12:10.597 hazelworker[19607] ###Noodle load address: 0x102a38000
2024-09-28 16:12:10.597 hazelworker[19607] ###CK load address: 0x102638000
2024-09-28 16:12:10.624 hazelworker[19607] Processing folder ExtensionTest
2024-09-28 16:12:12.722 hazelworker[19607] README.md: Rule Testing matched.
2024-09-28 16:12:12.736 hazelworker[19607] Hazel Alert: /Users/*******/Documents/ExtensionTest README.md 4:12 PM Testing
2024-09-28 16:12:12.736 hazelworker[19607] [Custom Message] Hazel Alert: /Users/*******/Documents/ExtensionTest README.md 4:12 PM Testing
2024-09-28 16:12:12.744 hazelworker[19607] Done processing folder ExtensionTest
2024-09-28 16:12:22.278 hazelworker[19610] Running worker (v5.3.4) for folder with identifier: 16777231-93486578.
2024-09-28 16:12:22.279 hazelworker[19610] ###Arch: arm64
2024-09-28 16:12:22.279 hazelworker[19610] ###main load address: 0x100e60000
2024-09-28 16:12:22.279 hazelworker[19610] ###Hazel Core load address: 0x101030000
2024-09-28 16:12:22.279 hazelworker[19610] ###Noodle load address: 0x101320000
2024-09-28 16:12:22.279 hazelworker[19610] ###CK load address: 0x100f20000
2024-09-28 16:12:22.295 hazelworker[19610] Processing folder ExtensionTest
2024-09-28 16:12:24.410 hazelworker[19610] Done processing folder ExtensionTest

What am I doing wrong?
PunicHeir
 
Posts: 2
Joined: Sat Sep 28, 2024 3:49 am

A rule can't match something that doesn't exist. If you want to trigger changes to the Extensions folder, then you need to have a rule match that folder, not the stuff that may or may not be inside it. To do that, you need to monitor the folder containing Extensions and then have the rule match the Extensions folder.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:A rule can't match something that doesn't exist. If you want to trigger changes to the Extensions folder, then you need to have a rule match that folder, not the stuff that may or may not be inside it. To do that, you need to monitor the folder containing Extensions and then have the rule match the Extensions folder.


Thank you for the explanation. I had actually managed to solve my problem by doing exactly what you suggested.
PunicHeir
 
Posts: 2
Joined: Sat Sep 28, 2024 3:49 am


Return to Support