I want to use launchd to kick off a script to backup changed files. It looks like it should work for what I want to do, but I don't know how to pass to my script that launchd starts, the path of the updated file. So if I'm watching directory foo and file bar.txt is changed, how do I get my launchd.plist or the script it runs to get the value of bar.txt?
I haven't found any way to do it with launchd. Could you just use rsync or something? Or check the modification dates in the script, by for example using find if it's a shell script:
Folder actions do get pathnames as an argument, but they are only run when files are added to a folder and not when files are modified. You can create a folder action by using the folder action template in Automator, or by saving a script like the one below in