我想使用 pysftp 0.2.8 将多个文件从 Windows 目录上传到 SFTP 服务器。我已经阅读了文档,它建议使用put_dorput_r但两者都给我以下错误:
OSError:无效路径:
sftp_local_path = r'C:\Users\Swiss\some\path'
sftp_remote_path = '/FTP/LPS Data/ATC/RAND/20191019_RAND/XML'
with pysftp.Connection("xxx.xxx.xxx.xxx", username=myUsername, password=myPassword) as sftp:
with sftp.cd(sftp_remote_path):
sftp.put_r(sftp_local_path, sftp_remote_path)
for i in sftp.listdir():
lstatout=str(sftp.lstat(i)).split()[0]
if 'd' in lstatout: print (i, 'is a directory')
sftp.close()
我希望能够将所有文件或选定文件从我的本地目录复制到 SFTP 服务器。
青春有我
相关分类