Click here to Skip to main content
14,455,121 members
Rate this:
Please Sign up or sign in to vote.
See more:
HI

I currently run a process where i export a file to an FTP server and another process that collects the file.

As the process runs every 5mins i found sometimes that the file being uploaded to the FTP server is sometimes not yet completed before the other process starts running so only half the file gets collected from the FTP.

What would be the best way for me to ensure that the complete file gets picked up?
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Strange that you do not get an ACCESS DENIED error. I suggest the "second process" to check for full access to the file first, by creating a FileStream with FileShare.None. If that fails, wait a few seconds, then try again till a timeout or full access. Only then start the actual processing.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100