Search code examples
pythonfilenetwork-programmingsftpparamiko

How does the confirm parameter of the paramiko put work


I noticed, that there is a parameter named confirm for the put method of the paramiko package. I want to know how it works. what is its function? and how to test it.


Solution

  • See the SFTPClient.put documentation:

    confirm (bool) – whether to do a stat() on the file afterwards to confirm the file size

    If the size does not match, the SFTPClient.put throws IOError exception with "size mismatch in put!" message.

    See also Paramiko put method throws "[Errno 2] File not found" if SFTP server has trigger to automatically move file upon upload.