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


in reply to Cron Job??

kschwab makes a very good point. How do you know when the transfer is done? I used the following to see if the file was modified at least ten seconds ago (Hopefully avoiding a race condition):

$getinfile=$indir.$infile; ($device,$inode,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctim +e, $blksize,$blocks) = stat($getinfile); my($timenow)=time; $delta=$timenow-$mtime; if ($delta < 10) #***file too young, wait a few seconds { next; #***jump to the end of the loop }

I haven't actually seen a race condition, but, like kschwab, worried about it. I would take advice on any (more coherent) means of assuring a file was closed.

-Diskcrash