python scp dir

作者: 橙姜 | 来源:发表于2018-04-13 17:28 被阅读0次

import paramiko
from contextlib import closing
from scpclient import WriteDir

ssh_client = paramiko.SSHClient()
ssh_client.load_system_host_keys()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect("10.239.168.112", username="user", password="123456")

with closing(WriteDir(ssh_client.get_transport(), '~/remote_dir/')) as scp:
scp.send_dir('./local_dir/', preserve_times=True)

相关文章

网友评论

    本文标题:python scp dir

    本文链接:https://www.haomeiwen.com/subject/wkhhkftx.html