最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

windows上用python从linux服务器下载文件到指定路径

业界 admin 3浏览 0评论
#!/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)

 

#!/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)

 

发布评论

评论列表 (0)

  1. 暂无评论