Is there anything like inotify on Windows?
take a look at this: inotify-win, a port of the inotifywait tool for Windows
and also this: inotify-tools, a C library and a set of command-line programs providing a simple interface to inotify
See the FindFirstChangeNotification API, or the .NET counterpart FileSystemWatcher
If you're using .net, use FileSystemWatcher
. More info here: http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
If you're using C, use FindFirstChangeNotification
, FindNextChangeNotification
, ReadDirectoryChangesW
. More info here: http://msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx
On OSX, the relevant api is the fsevents
api.
They're all subtly different from one another, and they all have questionable reliability in edge cases. In general, you can't depend on these apis for a complete view of all changes 100% of the time. Most people using file system monitoring combine it with periodic scans to compensate for lost or incomplete information from the push api.