fsevents
kqueue is a wonderful tool if you want to monitor individual things, like detecting single file changes or modifications to a single folder. However, kqueue doesn’t scale well (API-wise) if you need to monitor a hierarchy of directories. To see changes to a directory hierarchy, you have to open each of the directories and subdirectories and add them to a kqueue. You also need to open any new subdirectories that are created and add them to your kqueue. Open file descriptors are a scarce resource, so you could run out of them before you run out of directories to monitor. OS X 10.5 introduced FSEvents, file system events, which will notify you if something changes in the file system as a whole, or in a particular directory hierarchy. FSEvents ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access