wm=pyinotify.WatchManager() def DO_THIS(): print "CREATED DIR OR FILE IN /home/lefti/pokus" wm.add_watch('/home/lefti/pokus',pyinotify.EventsCodes.IN_CREATE,DO_THIS,True,True) notifier=pyinotify.Notifier(wm) try: while True: notifier.process_events() except KeyboardInterrupt,Hangup: notifier.stop()