예제 #1
0
 public void Execute(string ftpUri, string path = null, string username = null, string password = null)
 {
     Console.WriteLine("Renaming...");
     try
     {
         using (var ftp = new FileTransferProtocol(ftpUri, path, username, password))
         {
             ftp.Rename();
             Console.Write(ftp.RequestStatus);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine($"{ftpUri} rename error -> {exception.Message}");
     }
 }
예제 #2
0
        public void CheckRenameDirectory()
        {
            string ftp_uri = $"{Config.Server_Address}/new_directory";

            try
            {
                using (var ftp = new FileTransferProtocol(ftp_uri, "new_directory_renamed", Config.Username, Config.Password))
                {
                    ftp.Rename();
                    Assert.That(ftp.RequestStatusCode == FtpStatusCode.FileActionOK);
                }
            }
            catch (Exception exception)
            {
                if (exception is WebException)
                {
                    Assert.Fail(exception.Message);
                }
            }
        }
예제 #3
0
        public void CheckRenameFile()
        {
            string       ftp_uri = $"{Config.Server_Address}/uploaded_zip_file.zip";
            const string path    = "renamed_zip_file.zip";

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