1import pyinotify 2import sys 3 4wm = pyinotify.WatchManager() 5mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY 6 7 8class EventHandler(pyinotify.ProcessEvent): 9 10 def process_default(self, event): 11 quit() 12 13 14handler = EventHandler() 15notifier = pyinotify.Notifier(wm, handler) 16wdd = wm.add_watch(sys.argv[1], mask, rec=True) 17 18notifier.loop() 19