将文件从一个文件夹复制到FTP服务器上的另一个文件夹
问题描述:
嗨;
我想将文件从FTP服务器文件夹复制到同一ftp服务器上的另一个文件夹.
任何帮助将不胜感激.
Hi;
I want to copy a file from FTP server folder to another folder on the same ftp server.
any help would be appreciated.
thanks.
答
没有此类FTP操作,因此解决方案是将文件读入内部缓冲区(或使用System.IO.Path.GetTempFileName
的临时文件,请参见 http://msdn.microsoft.com/en-us/library/system.io.path. aspx [^ ],然后使用FTP将其复制到另一个目录中的新文件中.
要使用FTP,您将需要使用System.Net.FtpWebRequest
和System.Net.WebRequestMethods.Ftp
,请参见:
http://msdn.microsoft.com/en-us/library/system.net. ftpwebrequest.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system. net.webrequestmethods.ftp.aspx [ ^ ].—SA
There is no such FTP operation, so the solution is to read the file into internal buffer (or a temporary file usingSystem.IO.Path.GetTempFileName
, see http://msdn.microsoft.com/en-us/library/system.io.path.aspx[^] and copy it onto a new file in another directory using FTP.
To work with FTP, you will need to useSystem.Net.FtpWebRequest
andSystem.Net.WebRequestMethods.Ftp
, see:
http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx[^],
http://msdn.microsoft.com/en-us/library/system.net.webrequestmethods.ftp.aspx[^].—SA