Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyinotify
- import sys
- wm = pyinotify.WatchManager()
- wm.add_watch(sys.argv[1],
- pyinotify.IN_DELETE |
- pyinotify.IN_CREATE |
- pyinotify.IN_MODIFY,
- rec=True)
- class EventHandler(pyinotify.ProcessEvent):
- def process_IN_CREATE(self, event):
- print("Creating:", event.pathname)
- def process_IN_DELETE(self, event):
- print("Removing:", event.pathname)
- handler = EventHandler()
- notifier = pyinotify.Notifier(wm, handler)
- notifier.daemon = True
- notifier.loop()
Advertisement
Add Comment
Please, Sign In to add comment