Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.2k views
in Java FTP by (163k points)
A user writes:

Hi,
I have a development with your api in java.
This is really nice for me. My program every 5 minutes, it connect itself to the ftp server, list the directory and do "get" all files. But i can one problem. if the file to get, still not finished by de source, the transfer is incomplete. How can i detect if the origin file is complete before transfer it to my directory???


The best way to deal with this problem is for the program putting the file on the FTP server to use a temporary name, e.g. myfile.xyz.tmp. When it has finished placing the file on the FTP server, it then renames the file to myfile.xyz.

The client program polls for myfile.xyz, and when it appears, you know the entire file is there.

An alternative is write a second file myfile.xyz.ready which is written *after* the first one. The client program polls on the second file. When it finds it, it knows that myfile.xyz is ready to be downloaded.

Please log in or register to answer this question.

Categories

...