Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell if a file has finished being FTPed?

Tags:

c#

file-io

ftp

We have a C# Windows service polling a folder waiting for an FTP’ed file to be posted in. To avoid using the file when it is still being written to we attempt to get a lock on the file first, however, there seems to be occasions where we are getting a lock on the file after the FTP’ed file is created but before the file is written to, so we end up opening an empty file.

Is there a reliable anyway to tell if the FTP is complete?

like image 253
Graham Avatar asked Nov 28 '22 12:11

Graham


1 Answers

You could possibly change the filename before upload, then rename it after it's done. that way it will look like it doesn't exist until finished.

like image 197
John Boker Avatar answered Dec 04 '22 23:12

John Boker