コード例 #1
0
 public void Execute(string ftpUri, string path = null, string username = null, string password = null)
 {
     Console.WriteLine("Deleting file...");
     try
     {
         using (var ftp = new FileTransferProtocol(ftpUri, path, username, password))
         {
             ftp.DeleteFile();
             Console.Write(ftp.RequestStatus);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine($"{ftpUri} make directory error -> {exception.Message}");
     }
 }
コード例 #2
0
        public void CheckDeleteFile()
        {
            string ftp_uri = $"{Config.Server_Address}/renamed_zip_file.zip";

            try
            {
                using (var ftp = new FileTransferProtocol(ftp_uri, null, Config.Username, Config.Password))
                {
                    ftp.DeleteFile();
                    Assert.That(ftp.RequestStatusCode == FtpStatusCode.FileActionOK);
                }
            }
            catch (Exception exception)
            {
                if (exception is WebException)
                {
                    Assert.Fail(exception.Message);
                }
            }
        }