📜  从 FTP c# 代码示例中删除文件

📅  最后修改于: 2022-03-11 14:48:49.484000             🧑  作者: Mango

代码示例1
private string DeleteFile(string fileName)    
{    
   FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.server.com/" + fileName);    
   request.Method = WebRequestMethods.Ftp.DeleteFile;    
   request.Credentials = new NetworkCredential("username", "password");    
    
   using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())    
   {    
      return response.StatusDescription;        
   }    
}