ComponentPro UltimateSftp

      Upload multiple files

      Language Filter: AllSend comments on this topic to ComponentPro

      It is easy to upload multiple files to an SCP server using the Ultimate SFTP component, simply provide the local path, remote path and search pattern to the Upload methods. The following example shows you how to use one of these methods.

      using System;
      using ComponentPro.Net;
      // Create a new class instance.
      Scp client = new Scp();
      // Connect to the SCP server.
      // Authenticate.
      client.Authenticate("userName", "password");
      //// ... 
      // Upload all directories, subdirectories, and files in local folder 'c:\myfolder' to '/myfolder'.
      client.Upload("c:\\myfolder", "/myfolder", "*.*");
      // Upload all directories, subdirectories, and files that match the specified search pattern in local folder 'c:\myfolder2' to '/myfolder2'.
      client.Upload("c:\\myfolder2", "/myfolder2", "*.cs");
      // ... 
      // Disconnect.