Guest User

Untitled

a guest
Aug 8th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import pyinotify
  2. import sys
  3.  
  4. wm = pyinotify.WatchManager()
  5. wm.add_watch(sys.argv[1],
  6. pyinotify.IN_DELETE |
  7. pyinotify.IN_CREATE |
  8. pyinotify.IN_MODIFY,
  9. rec=True)
  10.  
  11. class EventHandler(pyinotify.ProcessEvent):
  12. def process_IN_CREATE(self, event):
  13. print("Creating:", event.pathname)
  14.  
  15. def process_IN_DELETE(self, event):
  16. print("Removing:", event.pathname)
  17.  
  18. handler = EventHandler()
  19. notifier = pyinotify.Notifier(wm, handler)
  20. notifier.daemon = True
  21. notifier.loop()
Advertisement
Add Comment
Please, Sign In to add comment