File-level filesystem change notification in Mac OS X

EDIT: Not verified, but Konstantin indicates below that this code sample is obsolete as of 2012.

I don’t believe there’s a specific API for what you’re looking for. Apple provides sample code for a similar problem called Watcher. It is not what you are looking for, but it is about the best you can do at this point. You have to take snapshots of the directory, and rescan it when you find out something changed. Modification time is the best thing to check of course, if you can trust modification time.

You are probably correct that trying to register for an unbounded number of kqueues would likely be unworkable.

Leave a Comment