How are the files being transfered? The most reliable solution is to transfer to a temporary filename and have the client rename it to the proper filename upon completion. rsync, for example, does this automatically during transfers.
If you cannot control the file names adequately, (say people are FTP'ing the files in) and you are on a linux box, you could check the output of lsof and see if the file is still open by any process.
Matt
| [reply] [d/l] [select] |
I've had to deal with that very issue here. I gave a pretty decent solution here, in the same thread. The solution given is the solution currently used in a very large bank for processing a ton of various files coming in from various sources (some controlled, some not) onto various OS's. Give it a whirl!
------
We are the carpenters and bricklayers of the Information Age.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
| [reply] |
Just touch a file at the end of transfer and only process those files that are older than the touched file (or all of them if the file isn't there). Or if you can't touch a file on the remote system (or a reasonable equivalent), perhaps you could send a manifest (with file sizes) before sending anything else.
| [reply] |