Currently, I am using Paramiko to connect to an Sftp server to find a file and then rename the file in a new directory. I can use sftp.get() to get the file and place it in my directory, however, when I use rename, I receive an error:
FileNotFoundError: \[Errno 2\] No such file.
The file does exist cause I can go to the sftp server and find the file and also because I can use sftp.get(). The final call looks like the following:
edit: (added the file paths)
StudentLitemaxfilepath = '/SchoolDistricts/South Orangetown/Level 0 Auto Imports/NY500301_StudentLite_SFTP_202402271345.csv
new_student_lite_path = X:/L0AutoImport/NY500301_STUDENT_LITE_UPDATE_2024_02_27.csv
sftp.rename(StudentLitemaxfilepath, new_student_lite_path)
The path includes the old name of the file and the path on StudenLitemaxfilepath and it includes the new name and new path on new_student_lite_path. The weird thing is I got it to work a couple of days before, but now it's not working. Let me know if I am making a dum mistake. Also, I apologize for anything I did wrong in my post. This is my first question.
I tried using:
sftp.rename(StudentLitemaxfilepath, new_student_lite_path)
and was expecting the file from the first path to be moved to the second path with a new name. Instead I got the following error:
FileNotFoundError: [Errno 2] No such file.
Note: For some reason the sftp.get() works but I do not understand why. I was able to get and move the file to a new directory and even change its name. Exactly how sftp.rename() should work.