Watch a folder recursively. Calls a function whenever files are added, deleted or modified.
The function will receive the following parameters:
dir_watched: the root directory being watched updated: a list of pathnames modified added: a list of pathnames just added removed: a list of pathnames just removed All pathnames are relative to dir_watched
from watch import WatchFolder
def update(dir_watched, updated, added, removed):
if added: print "Added: ", ", ".join(added)
if removed: print "Removed: ", ", ".join(removed)
if updated: print "Updated: ", ", ".join(updated)
monitor = WatchFolder(".",update).run()
These details are provided for information only. No information here is legal advice and should not be used as such.