Home Forums .NET libraries Xceed SFTP/FTP for .NET Determine if file is available for download

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20803 |

    I have an application that will poll a remote server at a specific interval and look for new files to download. When I find files to down load, then start to download them, it could be possible that the file is still being wrote to disk on the remote server.

    I do not want to try and retrieve the file while it is still being wrote. What is the best way to handle this?

    My first thoughts are to retrieve the file size, then check back after a few minites and compare the previous file size to the current file size. Then repeat this a few times until the size does not change. I was hoping that Xceed may have something built in, or that there is another more efficient way?

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Chris (had 2486 views)

    User (Old forums)
    Member
    Post count: 23064

    There is no easy way to find if a file has finished being written by another process to the server. For that, the server would had to provide a feature where a process could know if a file is being read/written to by another process.

    This is not part of the FTP protocol standard, which means there is no command you can send to the server to get this information.

    Therefore, checking the file size (and/or time stamp?) is most likely the only means you have to know if a file is ready to be transfered.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 3255 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.