To upload files and directories from another file system such as the ZIP file system to an SFTP server, use the Upload method overloads that have the sourceFileSystem parameter like this Upload method.
The following example code shows you how to connect to an SFTP server and upload files from a ZIP file on-the-fly.
using System; using System.Collections.Generic; using System.Text; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro.Compression; ... // Connect to an SFTP file system. Sftp sftp = new Sftp(); sftp.Connect("demo.componentpro.com", 22); sftp.Authenticate("test", "test"); // Open an existing zip file. Zip zip = new Zip(); zip.Open(@"c:\test.zip"); // Extract and upload all files within the archive to the SFTP server. // This operation directly uploads files to the SFTP server, no temporary files created. zip.ExtractAll(sftp, "", FileOverwriteMode.Overwrite); // Close all used resources. zip.Close(); sftp.Disconnect();