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.