in reply to Re^2: Finding if a file is open
in thread Finding if a file is open
flock will help. Just do:
use Fcntl; # get LOCK_EX constant open F, $file or error("Can't open $file $!\n"); flock(F, LOCK_EX) or error ("Can't get exclusive lock, file open and l +ocked by other app $!\n"); close F;
Alternatively there is a program called oh.exe in the windows resource kit that returns a list of open file handles and the programs that have them open. handle.exe which came from sysinternals (now M$) can do the job on a specific file. If you look hard enough you may be able to find the underlying code and convert this perl.
|
|---|