I am trying to use FTPWebRequest Rename method, below is my code snippet.
Dim str1 As String = "ftp://slsdevvs01.am.cdkgroup.net/%2fDataTrans/%2f"
Dim str2 As String = "Archive/Outbound/"
Dim str3 As String = "CDK_IS_20220603_092921.CSV"
Dim str4 As String = "Old/CDK_IS_20220603_092921.CSV"
Dim cdkCommandFTP As New NetworkCredential(My.Settings.FTPUser, My.Settings.FTPPass)
requestFTP = DirectCast(System.Net.WebRequest.Create(str1 & str2 & str3), FtpWebRequest)
requestFTP.Credentials = cdkCommandFTP
requestFTP.Method = WebRequestMethods.Ftp.Rename
requestFTP.RenameTo = str4
requestFTP.GetResponse()
When i am trying to run my application i am getting the below error after GetResponse()
The remote server returned an error: (550) File unavailable (e.g., file not found, no access) rename
I have passed the working credentials and the file also exists in the location