Freitag, November 09, 2007

Tim Golden's Python Stuff: Watch a Directory for Changes

Tim Golden's Python Stuff: Watch a Directory for Changes: "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. There are more sophisticated alternatives involving audit logging and volume change management, but I know next-to-nothing about them, and I suspect they're OTT for most people."

Keine Kommentare: