How do I watch a directory for changes on Windows?
Tim Golden writes:
The requirement: to know when files have been added, removed or updated within a directory.
There are several approaches you can take to monitoring a directory under Win32. I’m going to compare three: the first, to poll the directory every few seconds using os.listdir; the second, to use the FindFirstChangeNotification API; the third, to use the ReadDirectoryChanges API. Each is presented with its pros & cons.