import pyinotify | |
import sys | |
wm = pyinotify.WatchManager() | |
mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY | |
class EventHandler(pyinotify.ProcessEvent): | |
def process_default(self, event): | |
quit() | |
handler = EventHandler() | |
notifier = pyinotify.Notifier(wm, handler) | |
wdd = wm.add_watch(sys.argv[1], mask, rec=True) | |
notifier.loop() |