Python本地和服务器实现文件上传下载

# !/usr/bin/env python

# -*- coding: utf8 -*-

# coding: utf-8

import paramiko

import datetime

import os

import sys

reload(sys)

sys.setdefaultencoding('utf-8')

hostname= '192.0.0.0'

username= 'root'

password= '123'

port= 22

def upload(local_dir, remote_dir):

    try:

        t= paramiko.Transport((hostname, port))

t.connect(username=username, password=password)

sftp= paramiko.SFTPClient.from_transport(t)

print('upload file start %s ' % datetime.datetime.now())

for root, dirs, filesin os.walk(local_dir):

            print('[%s][%s][%s]' % (root, dirs, files))

for filespathin files:

                local_file= os.path.join(root, filespath)

print(11

你可能感兴趣的:(python,sftp,selinux,processing,gps)