Search code examples
pythonlinuxinotifypyinotify

Pyinotify -- event raised from original path after directory renaming


I use pyinotify to monitor my file system. The problem is when I rename a directory and create file in the renamed directory, the event is raised from original path(referred by event.name). Can't figure out what is wrong? Any problem with the add_watch flag when initializing the watcher? Currently the flag is set as rec=True, auto_add=True.

Thanks and best regards.


Solution

  • You need to add the IN_MOVE_SELF event to your mask.

    Source