【发布时间】:2020-06-03 21:15:07
【问题描述】:
我尝试在两台服务器之间传输文件。 我用了帕拉米科。有一个名为“数据”的目录,但它说:
IsADirectoryError: [Errno 21] 是目录:'/home/mmoradi2/data/'
我不知道是什么问题。这是我的代码:
import paramiko
s = paramiko.SSHClient()
s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
s.connect(hostname='****8', username='****',password='****',port=22)
sftp = s.open_sftp()
list_files_share_drive = sftp.listdir('./')
# Looping through the files and transferring them to the data folder and importing them
the_file = list_files_share_drive[0]
sftp.get( '/home/sftpwis/'+ the_file , '/home/mmoradi2/data/')
我将目标 ('/home/mmoradi2/data/') 更改为: '/home/mmoradi2/数据' 和 '/home/mmoradi2'
它不起作用,我遇到了同样的错误。我将其更改为“/home/mmoradi2/Data/”。然后我没有错误,但是有一个新目录我不能 cd 到它!!! (打不开)
我该如何解决这个问题?
【问题讨论】:
标签: python ubuntu paramiko file-transfer