in reply to check which files are open to write/read by another process

This issue is operating system specific. The path syntax used in your question indicates you are running on some sort of UNIX.

On Linux it is fairly easy if you know the PID that the script is running under. You can interrogate /proc/PID/fd, then follow the links using readlink. Alternatively you can use Linux::Inotify2 to monitor the directory being written to.

On non-Linux UNIX systems iNotify does not exist, and so far as I know many systems do not provide the links in /proc/PID/fd. In those cases you might have to resort to running strace(1) or truss(1) programs (only tracing the open(2) calls) in a pipe then interrogating the output. I have used this method, but it is messy.
  • Comment on Re: check which files are open to write/read by another process

Replies are listed 'Best First'.
Re^2: check which files are open to write/read by another process
by JavaFan (Canon) on Nov 24, 2010 at 12:42 UTC
    Actually, most non-Linux Unix OSses (and even most Linux distros) have at least one of fuser or lsof (the latter stands for 'list open files'...). Of course, to get that information about processes run by a different UID than you currently are, you need root privs.
      fuser is in the POSIX standard, lsof is not.