What is the most efficient way to detect file changes for adding / removing / renaming a directory in Python?

If I have a table representing the paths and sizes of files / subdirectories inside directory A, how can I detect recursive changes in directory A so that I can efficiently update the table?

+7
python
source share
2 answers

I am using watchdog , which is a python library for this kind of thing. If you want to know how they do it, you can dive into the source code of the project.

+5
source share

If you are using linux, use pyinotify

+3
source share

All Articles