Can you monitor a folder for changes?

We can monitor folders in at least three ways:

  • Using AppleScript Folder Actions, which can monitor when files are added or removed form a folder, or when the folder window is opened, closed, or moved int he Finder. see Folder Actions Reference.
  • Using a launchd launch agent, which can launch a unix script or script application when the file system changes at a particular path. See Launch Daemons and Agents.
  • Create an AppleScript application that uses AppleScriptObjC to receive notifications for file system changes. I can add an example of that if you think it's necessary, though I'd recommend using one of the others for most cases.

I suppose something could be done using syslog, but it seems like a lot more work than the approaches I mentioned.