问题
Please let me know how do I use paramiko module to transfer files between two remote hosts.
I have seen that 'get' method will get the files from remote host to local host. 'put' method will put the local files to some remote host.
Is there any method that combines 'get' and 'put' methods i.e.get files from remote host and put it in remote host. This request will get initiated from localhost.
回答1:
Paramiko.sftp_client.SFTPClient
provides SFTP (Secure File Transfer Protocol) features to move files between computers. After starting an sftp session via
ssh = client.open_sftp()
,
you can access all of these methods.
If you just want to move files on the remote host, then you can use "local" file transfer methods with shutil. Hope that helped!
来源:https://stackoverflow.com/questions/47584192/how-to-use-paramiko-to-transfer-files-between-two-remote-servers