windows上用python从linux服务器下载文件到指定路径
#!/usr/bin/env python# coding: utf-8import paramikodef remote_scp(host_ip, remote_path, local_path, username, password):t = paramiko.Transport((host_ip, 22))t.connect(username=username...
·
#!/usr/bin/env python
# coding: utf-8
import paramiko
def remote_scp(host_ip, remote_path, local_path, username, password):
t = paramiko.Transport((host_ip, 22))
t.connect(username=username, password=password)
sftp = paramiko.SFTPClient.from_transport(t)
src = remote_path
des = local_path
sftp.get(src, des)
t.close()
if __name__ == '__main__':
host_ip = '192.168.8.75'
remote_path = '/home/user/data*.log'
local_path = r'E:\data'
username = 'root'
password = 'root'
remote_scp(host_ip, remote_path, local_path, username, password)
更多推荐
已为社区贡献3条内容
所有评论(0)