http://www.perlmonks.org?node_id=640856

jmurphy has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I'm racking my tiny brain and shockingly still can't come up with an elegant solution for the following problem:

Is it possible to determine whether an external process is writing to file on Windows? I'm writing a Perl application that polls the file system. It looks for files with a certain extension (.log) and if it finds one it takes action. However, it shouldn't take action until the external application has finished writing the log file. Therefore the polling application needs to check and see of the external process is still writing to the file.

Is there an easy way to do this? I've read the archives and I see that some people have used stat in order to check for changes in the size and/or modified date of a file. However, this seems so primitive. Any elegant solutions out there?

Thanks so much,
Jay