This method represents FTP RNFR/RNTO command pair.
By default, the file will be renamed in the current working directory. If you want to rename the file from another location, you could use the SetCurrentDirectory method to change the current working directory. Absolute paths can also be provided. However, some FTP servers might not support absolute paths, and different server types may have different ways of representing absolute paths. The current working directory can be retrieved via the GetCurrentDirectory method.
Shows how to use Rename method to rename a file.
using ComponentPro.Net; ... // Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Rename remote file '/file.dat' to 'myfile.dat' client.Rename("/file.dat", "/myfile.dat"); // Move a file client.Rename("/file2.dat", "/new-folder/file2.dat"); // Rename a remote directory client.Rename("/album-folder", "/old-album-folder"); // Move a directory client.Rename("/album-folder2", "/new-folder/album-folder2"); // ... // Disconnect. client.Disconnect();