I have a program that needs to move a file from one directory to another on an FTP server. For example, the file is in:
ftp://1.1.1.1/MAIN/Dir1
In following code example I tried with following data and it works.
FTP Login location is "C:\FTP".
File original location "C:\FTP\Data\FTP.txt".
File to be moved, "C:\FTP\Move\FTP.txt".
Uri serverFile = new Uri(“ftp://localhost/Data/FTP.txt");
FtpWebRequest reqFTP= (FtpWebRequest)FtpWebRequest.Create(serverFile);
reqFTP.Method = WebRequestMethods.Ftp.Rename;
reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPass);
reqFTP.RenameTo = “../Move/FTP.txt";
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();