Programming Tips - How can my program efficiently detect when files in a
Date: 2007nov6 Library: FAM Q. How can my program efficiently detect when files in a folder have changed? A. On Linux/Unix the answer is FAM (File Alteration Monitor). More info here: http://en.wikipedia.org/wiki/File_alteration_monitor On Linux, inotify has replaced FAM: http://en.wikipedia.org/wiki/Inotify (Do "man inotify" for info) These have a rather nice interface. You open a folder and wait on a read. You get data when a change occurs. Eventually, close the handle. Its like reading a stream. My only complaint is that, at least in my last try, they could not monitor a tree. On Windows, use FindFirstChangeNotification() Its API is more painful. Windows now has ReadDirectoryChanges and FileSystemWatcher.