尝试传输.txt .xml等文件时。但是当将整个目录传输到另一个目录时,它会给出错误。 让我知道代码有什么问题。为什么它没有转移目录
import paramiko
import os
paramiko.util.log_to_file('/tmp/paramiko.log')
host = '10.2.216.195'
t = paramiko.Transport((host))
t.connect(username = 'stack',password = 'flow')
sftp = paramiko.SFTPClient.from_transport(t)
filepath = '/home/proteek'
localpath = '/home/proteek/newfolder/movie'
sftp.get(localpath,filepath)
sftp.close()
t.close()
它给出的错误是
File "/usr/lib/python2.6/site-packages/paramiko/sftp_client.py", line 599, in get
fl = file(localpath, 'wb')
IOError: [Errno 21] Is a directory: '/home/proteek/movie'