Recursive option
Opened this issue ยท 4 comments
Thanks for sharing this. I will definitely be leveraging this in the future. Do you have any plans to add support for recursive notifications as well? I have a few use cases where this would be extremely useful[1].
[1] https://github.com/PUNCH-Cyber/stoq-plugins-public/blob/master/dirmon/dirmon/dirmon.py#L46-L68
Yes, it's planned for the higher level Minotaur
object, at the moment it's very vague, I haven't honed in on what I think would be the long-term stable interface for that. Should there just be a recursive flag for add_watch()
perhaps?
I think you are spot on. Calling add_watch(recursive=True)
would be the simplest way from a user perspective. This is also similar to how watchdog
[1] handles recursive notifications which has worked very well for me in the past.
Yeah, I think at that point it must make sure CREATE|DELETE|RENAME_FROM|RENAME_TO
are added in to the mask, then it needs to add the watch, then do a scandir()
to recurse through pre-existing directory structure to add new watches, and then finally, for each event, to make sure it updates its internal representation of the watches whenever one gets renamed or removed.
Oh man, I have reviewed up to 5 projects that provides asyncio interface around inotify and none of them support the recursive option ๐