Is there anything like inotify on Windows?
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.
See the FindFirstChangeNotification API, or the .NET counterpart FileSystemWatcher