public void Execute(string ftpUri, string path = null, string username = null, string password = null) { Console.WriteLine("Removing directory..."); try { using (var ftp = new FileTransferProtocol(ftpUri, path, username, password)) { ftp.RemoveDirectory(); Console.Write(ftp.RequestStatus); } } catch (Exception exception) { Console.WriteLine($"{ftpUri} remove directory error -> {exception.Message}"); } }
public void CheckRemoveDirectory() { string ftp_uri = $"{Config.Server_Address}/new_directory_renamed"; try { using (var ftp = new FileTransferProtocol(ftp_uri, null, Config.Username, Config.Password)) { ftp.RemoveDirectory(); Assert.That(ftp.RequestStatusCode == FtpStatusCode.FileActionOK); } } catch (Exception exception) { if (exception is WebException) { Assert.Fail(exception.Message); } } }