I have a FileSystemEventHandler which watches for file deletions on the file system. This works in principle, but if I delete a large amount of files (e.g. > 1000 files), the method is not called for each and every file. The File System EventHandler implementation is as follows:
class Handler(FileSystemEventHandler):
def __init__(self) -> None:
super(Handler, self).__init__()
self.count = 0
def on_deleted(self, event) -> None:
self.count += 1
print(f"File delete detected: {event.src_path}")
print(self.count)
I would expect that the number printed sums up to the number of deleted files which is not the case. On large amount of deletions the FileSystemEventHandler seems to skip some events.
I'm using Python 3.10 on Windows 10