Simple_notify is a project mainly written in Python, it's free.
[abandoned] a python inotify wrapper that's trivial to use
Note: I have discontinued development of simple_notify,
in favour of using the cross-platform watchdog
library:
https://github.com/gorakhargosh/watchdog
Example:
import simple_notify def on_change(event): print "event " + event.event + " occurred to " + event.path
watcher = simple_notify.watch("/tmp", callback=on_change) raw_input("press enter to quit...")
watch() spawns a new thread that will watch for inotify events and call your callback function.
Directories are tracked recursively, so when watching "/tmp" you would see everything that happens in /tmp and any of its subdirectories
Your callback receives as its single argument an Event instance. Event instances have the following fields:
You can pass ignore_modifications=True
to watch
if you don't wish
to be nodified of file modification events (merely additions, removals
and moves).