Detecting dir (tree) changes fast?

Christian Heimes lists at cheimes.de
Mon Sep 29 10:41:10 CEST 2008


robert wrote:
> I want to detect changes in a directory tree fast with minimum 
> overhead/load. In order to check the need for sync tasks at high frequency.
> It must not be 100% reliable (its also forced time periodic), so kind of 
> hashing would be ok.
> How?

Almost every modern OS has some sort of support for IO notifications. 
For example pynotify on Linux, kqueue on BSD or ReadDirectoryChanges on 
Windows. You can also use polling and check the directories yourself 
every few seconds but that's expensive and doesn't scale.

Christian




More information about the Python-list mailing list