Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.2k views
in .NET FTP by (1.1k points)
I have a SFTP server that clients connect to and upload files. (small files 1300 to 10000 bytes)

I have a process that connects to the server and moves the files.

I get a list of files:

filesToLoad = sFTP.GetFileInfos(resultFolder & "\*.hl7")

Occasionally the second process moves a file while it is still being uploaded and I end up moving 0 bytes.

Is there anyway in the edtFTPnet/PRO library to know that a file is still being uploaded?

Thank you.

3 Answers

0 votes
by (162k points)
The client can't easily detect this (unless you know how large the files are, and you get the size before downloading).

The best solution is for the uploading clients to upload to a temp file, and then to do a rename at the end of the upload. If you filter out temp files in your listing then you'll only get files that are completely uploaded.
0 votes
by (1.1k points)
Thank you. I have control over about 65 percent of the client connections. I will update that application to do the rename scenario you outlined
0 votes
by (162k points)
Another option is to get the size before downloading, wait say 5 sec, and then get the size again. If the size is identical, you can assume that it still isn't being written to. This should work 99% of the time.

Categories

...