Not sure why this is not working, I am attempting to upload an entire directory from my local drive to the sftp but instead of uploading the folder it creates a file that looks like this ".\20200131\doc1.txt"? I have been at this for hours I think I am missing something
def upload_files_to_sftp():
localpath = r"c:\test\"
remotepath = "/uploads/test_Unzipped"
for root,dirs,_ in os.walk(r"c:\test"):
for d in dirs:
folders_to_upload = (os.path.join(root,d))
print(folders_to_upload)
with pysftp.Connection('mysftp', username='username', password='mypassword') as sftp:
sftp.put_r(localpath , remotepath)