Possible Duplicate:
How do I watch a file for changes using Python?
Detect File Change Without Polling
I am trying to write an application which must perform an action when files are modified or added within a particular directory and its sub-directories.
I imagine that an ideal solution would be to bind to some type of system event that is fired by the operating system when a file or directory is modified. Another less-than-ideal solution would be for my application to manually, recursively check for file changes within a directory at a specified time interval, but this could get incredibly process-intensive if there are lots of files that must be checked every few minutes.
Summary: What is the best way for my application to watch for file changes within a directory?
For the scope of this question, assume that my application is written in Python and the operating system is Linux-based, but generalized answers that solve this problem for other languages and operating systems such as Windows or Mac OS are most welcome.