FTP Server Move file directory

Source: Internet
Author: User

The file can already be moved because of a path problem. The Rename method is still used. The reason is renameto= ""; Here the path does not contain the file name, and the relative path and the absolute path are not right, so I have never believed that others said rename can move the file. Now knot paste, thank you! In order for Yimeimei to find the answer, I post the code and do a demonstration:
Ftp:10.62.80.x/temp/aa.pdf file path to move (source file path)
Ftp:10.62.80.x/youku/aa.pdf to move the directory (the file path after the move)
Instance:
FtpWebRequest reqftp;
Try
{

Reqftp = (ftpwebrequest) ftpwebrequest.create (New Uri ("Ftp://10.62.80.x/TEMP/aa.pdf")); x represents the actual IP, where the unknown is replaced by
Reqftp.method = WebRequestMethods.Ftp.Rename;
Reqftp.keepalive = false;
Reqftp.renameto = "~/youku/aa.pdf"; Here is the absolute path, we can change according to the actual situation
Reqftp.usebinary = true;
Reqftp.credentials = new NetworkCredential (LoginName, PassWord);
FtpWebResponse response = (ftpwebresponse) reqftp.getresponse ();
Stream FtpStream = Response. GetResponseStream ();

Ftpstream.close ();
Response. Close ();
}
catch (Exception ex)
{

}

The top is my help-csdn.

FTP Server Move file directory

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.