The problem is that the file is always "complete". It's just that it may be more "complete" a moment later. So if you seek to the end, and then check for EOF as you suggest, it'll probably return true. It won't if the file has actually grown in between the seek and the test, but you may be testing too quickly. As the others suggest, you could include some delay, but there's the risk that the delay won't be enough.
However, if that's your decision... rather than than actually opening the files and making some decision base on the content, why not just look at the timestamp on the files, and consider them complete if they're old enough?
will tell you how many seconds since it was last written (note that you can't use -M, since that's based on the start time of the program, not the current time).time-(stat $file)[9]
A better option, if you're on a UN*X system would be to use fuser on the file:
system "fuser -s $file"; print $?>>8?"complete":"still open";
--
Tommy
Too stupid to live.
Too stubborn to die.
In reply to Re: Treat a directory as file queue
by tommyw
in thread Treat a directory as file queue
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |