1

How can i know that file is still in writing process. As I am polling on folder location to search any file exists, then download file only when download is complete. I am using SFTP via JSCH java.

Castaglia
  • 2,972
  • 5
  • 28
  • 49
DemoUser
  • 51
  • 3

1 Answers1

2

A well-known way to solve this problem is to delegate the responsibility to the writer to write the file with a custom extension (such as .part).

Then when the file is effectively transferred the writer rename it on the filesystem which is an atomic operation.

If you don't have control on how the file could be writed, you could go with polling. You will have then to monitor the folder for files write times, considering a file is wrote after a specific amount of time being untouched.

John-Philip
  • 3,392
  • 2
  • 23
  • 52