So if I have a directory /dir
which can contain any number of files N and these files can be in any sub-directory in /dir
. How can I watch /dir
such that I get notified when a file in dir
or any of its sub-directories is opened? I don't want to watch all files and check if a lock is acquired for that file.
I have looked at FSEvents, but I am pretty sure that I cannot do it with that.
It is for the macOS operating system
So can anyone point me in the right direction or know a solution