I need some opinions / ideas here. I have a situation where a third party vendor is delivering files via ftp to one of our servers. They do not have the ability to do a 'rename' or any other ftp command outside of 'put'. We need to be able to tell when the file is complete and then move it to a processing directory.
A few methods have been used here before, but I don't really like them. They work fine, I'm just picky I guess.
One method was to watch the size over time. If the file didn't grow for X amount of time then consider it complete and begin processing. This has it's obvious flaws, just one of which being a slow network connection.
The other method was to perform and 'fuser -u' on the file and see if anything came back. Effective, but I prefer not to have to shell out of a perl script if I don't have to(I would like to keep this in perl).
Does anyone have a better way to see if a file is open or currently being written? It is possible to use Proc::ProcessTable, but that would be pretty ineffecient to run every 5 minutes (or sooner).
TIA,
Chad.
In reply to Detecting An Open File by gnu@perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |