Question

I am about to read the whole ietf spec for sftp but was wondering if someone has been through this before at all. Is it possible that sftp provides a mechanism that can be used to figure out if a file has been succesfully transferred (something like last byte out) or by design this is not possible?

Was it helpful?

Solution 2

It seems that there is no guaranteed way to know it.

OTHER TIPS

Use scp instead. According to the appropriate manual page (man scp):

 DIAGNOSTICS
      scp exits with 0 on success or >0 if an error occurred.

So, check the exit code of scp, and that should be what you need. sftp is really intended to be more of an interactive experience (although you can in fact call it in a batch-oriented sort of way, but it doesn't seem to provide as much useful information).

SFTP protocol doesn't have the concept of "file transfer". It has operations like "open file", "write to file at position X" (random access is supported) and "close file".

Potentially the SFTP server knows when the file is closed by the client and this can be treated as "upload complete". But in most cases there are no hooks for this. On the client side it's the same.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top