ComponentPro UltimateSftp

      Work with directories

      Language Filter: AllSend comments on this topic to ComponentPro

      You can easily create a new directory on the SCP server with the CreateDirectory method. We take advantages of this method with the following examples:

      using System;
      using ComponentPro.IO;
      using ComponentPro.Net;
      
      ...
      
      // Create a new class instance.
      Scp client = new Scp();
      
      try
      {
          // Connect to the SCP server. 
          client.Connect("localhost");
      
          // Authenticate. 
          client.Authenticate("test", "test");
      
          // ... 
       
          // Create a new directory. 
          client.CreateDirectory("test folder");
      
          // ... 
       
          // Disconnect. 
          client.Disconnect();
      }
      catch (ScpException exc)
      {
          Console.WriteLine("An error occurred: Code: {0}, Message: {1}", exc.Status, exc.Message);
      
          if (client.State != RemoteFileSystemState.Disconnected)
              client.Disconnect();
      }