Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ensure file A completely transffered in location LA before...

Status
Not open for further replies.

whloo

Programmer
Apr 14, 2003
168
SG
Hi All,

below is my situation:
----------
1) Process A (client) will drop file A into location LA at a random time.
2) My process will pick up file A from location LA to location LB in a scheduled time frame.
* I have no control over process A.

Problem:
----------
How do i ensure when my process in 2) only pick up a complete file A to transfer?


Thanks!

Best Regards,
weihann.
 
Investigate FileSystemWatcher and see whether these notifications are enough.

Also, try opening the file with read/write access: which should fail if another process is writing to it.

 
If this is via FTP, this protocol has no file locking, so the 3rd party could still be uploading when you check to see if it's there. There's two somewhat easy solutions, each with drawbacks:

1. Have the 3rd party write a very small (1 byte!) file to signal that they're done with the upload, and you watch for that file instead of the main file. Drawbacks: Now there's two files involved, plus the 3rd party needs to send two files.

2. Check to see if the file is there, and if it is, remember the filesize. Wait a period of time longer than the FTP session timeout, and check again. Compare the two filesizes -- if they're the same, the upload must have completed. Drawbacks: Takes longer because you have to wait. Also, the upload could have errored out, and you have no way of knowing.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top