Check when alias link is added or removed from folder

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

Moderator: Mr_Noodle

Hello there,

I've read through the documentation and search through previous posts, but didn't find answer so hopefully this is the right place for me to find answer. I'm trying to monitor when an alias link is added to a folder, and when it is deleted from a folder. If an alias link is added or deleted, then I also want to know the target path of the alias link. For example, if alias link to file A is created in folder B, then I want to detect that change and also know that the alias link was to file A.

Can Hazel help me with that? If so, it will directly solve my problem. Thanks!
Atlas
 
Posts: 6
Joined: Thu Mar 17, 2022 7:30 pm

What do you do with that information?

Hazel doesn't normally have actions that trigger on file removal. What you would need to do for that is to monitor the folder containing the folder which contains the alias (so you need to monitor one level up). You can then monitor the folder containing the alias for changes.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:What do you do with that information?

Hazel doesn't normally have actions that trigger on file removal. What you would need to do for that is to monitor the folder containing the folder which contains the alias (so you need to monitor one level up). You can then monitor the folder containing the alias for changes.



Thanks. I don't need actions to be taken by Noodlesoft. Whenever file alias A is removed from folder B, I will take the path of alias A as well as the path of folder B and feed it into a custom script (applescript or python).

In the folder monitoring function, can you check whether the changed item is an alias? It's not clear to me in the documentation.
Atlas
 
Posts: 6
Joined: Thu Mar 17, 2022 7:30 pm

For alias/file removal, there's no real way to do that since it is gone. You would need your own logic on the folder containing it to figure out what is missing.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support