I am putting together a simple app and I have it working for uploading, downloading, deleting files using FtpWebRequest. But I cannot find how to move a file using FtpWebRequest. What is the simplest way to move a file from one dir to another without using another external dependancy? Thanks in advance.
You can transfer files from your system to or from the product by using FTP in a number of ways: You can use a command-line program FTP, which many operating systems are providing. You can use one of many FTP client products with a graphical user interface. You can select the FTP protocol on your web browser.
To transfer files to another computer, open an FTP connection to that computer. To move files from the current directory of your computer, use the mput command.
Create a FtpWebRequest with the source file name, set the Method-Property of the FtpWebRequest to Use System.Net.WebRequestMethods.Ftp.Rename and set the RenameTo-Property of the FtpWebRequest to the new file name.
FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create("oldName");
request.Method = System.Net.WebRequestMethods.Ftp.Rename;
request.RenameTo = "newName";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With