We are transferring xml files to remote machine through cronjob @every 5 mins and then will move the files to the backup folder is source server.
Sometimes the file is transferred as 0kb to destination server, whereas the file in the source backup folder is completely written.
There is no error log recorded for the incomplete file transfer, so could you please help.
You transferring the file from source computer to the remote computer.
But where does the file in the backup folder come from? The source computer directly, or transferred back from the remote machine?
You use the word folder instead of directory, are you aware that on Microsoft systems the output of a directory listing does not show files that are open for output, whereas Unix/Linux systems do.
"Not open" doen't necessarily mean "finished creating" a file. It's not uncomon that files are being opened for append in a split second, repeatedly, thus increasing in size but their writing not being reliably detectable.
Can you make sure the file is greater than 0kB in the moment of the transfer?
If there is a remote chance that your destination file is "open for write" when you are transferring, you should step back and reconsider your strategy. The results of neither the file transfer nor the remote file creation will be predictable with processes competing. Even reading a file when the transfer starts will not yield reliable results.