gnu@perl has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Detecting An Open File
by valdez (Monsignor) on Jul 21, 2003 at 19:04 UTC | |
|
Re: Detecting An Open File
by flounder99 (Friar) on Jul 21, 2003 at 18:53 UTC | |
by gnu@perl (Pilgrim) on Jul 21, 2003 at 19:09 UTC | |
|
Re: Detecting An Open File
by Anonymous Monk on Jul 21, 2003 at 21:21 UTC | |
|
Re: Detecting An Open File
by waswas-fng (Curate) on Jul 22, 2003 at 05:04 UTC | |
|
Re: Detecting An Open File
by blue_cowdawg (Monsignor) on Jul 21, 2003 at 18:16 UTC | |
by gnu@perl (Pilgrim) on Jul 21, 2003 at 18:17 UTC | |
by blue_cowdawg (Monsignor) on Jul 21, 2003 at 18:19 UTC | |
by gnu@perl (Pilgrim) on Jul 21, 2003 at 18:41 UTC | |
|
Re: Detecting An Open File
by TVSET (Chaplain) on Jul 21, 2003 at 21:53 UTC | |
|
Re: Detecting An Open File
by rir (Vicar) on Jul 21, 2003 at 20:40 UTC |