Detecting dir (tree) changes fast?

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Mon Sep 29 04:47:33 EDT 2008


On Mon, 29 Sep 2008 10:05:10 +0200, 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?

Google is your friend. Googling for "python directory watcher" gives the 
following top three links:

http://www.amk.ca/python/simple/

http://timgolden.me.uk/python/win32_how_do_i/
watch_directory_for_changes.html
 (sorry for the broken URL)

http://code.activestate.com/recipes/217829/


There are probably many others. Which one is most suitable will depend on 
the details of, e.g. the OS you are using, the types of changes you're 
expecting, how many files are in the directory.



-- 
Steven



More information about the Python-list mailing list