1

I'm using launchd to detect changes of a specific path using "WatchPaths" key and then run some codes, but the content changes of sub-folders are not of interest.

For example, in order to monitor changes on my desktop, I'd add the following code in plist:

<key>WatchPaths</key>
<array>
    <string>~/Desktop/</string>
</array>

It is indeed working, but if I paste a file into a folder on the desktop, the plist is also executed, How to prevent this?

I've already looked through some posts and tutorials, but no clues at all:

Monitor a folder for changes, and run a command when a change is detected

https://www.launchd.info/

Any advice is welcome, thanks in advance.

You must log in to answer this question.

Browse other questions tagged .