We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

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.

For details, see http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html

CATEGORY: windows