public class SizeSearchCondition : SearchCondition
Shows how to use the AndSearchCondition class to download files that have .exe extension and are greater than 200kb.
using ComponentPro.Net; using ComponentPro.IO; ... // Create a new instance of the Ftp class. Ftp client = new Ftp(); // Connect to the server client.Connect("demo.componentpro.com"); // Authenticate. client.Authenticate("test", "test"); // Download '.exe' file and size greater than 200kb. // The '+' operator can also be used to combine two SearchCondition objects client.Download("/", @"C:\temp", new NameSearchCondition("*.exe") + new SizeSearchCondition(200 * 1024, long.MaxValue)); // Upload files starting with 'test' or ending with '.cs' or '.vb' and also larger than or equal to 1M client.Upload(@"C:\Test", "/", new AndSearchCondition(new NameSearchCondition("test*") | new NameSearchCondition("*.cs;*.vb"), new SizeSearchCondition(1024 * 1024, long.MaxValue)) ); // Close the connection. client.Disconnect();
Shows how to use the AndSearchCondition class to download files that have .exe extension and are greater than 200kb.
using ComponentPro.Net; using ComponentPro.IO; ... // Create a new instance of the Sftp class. Sftp client = new Sftp(); // Connect to the server client.Connect("demo.componentpro.com"); // Authenticate. client.Authenticate("test", "test"); // Download '.exe' file and size greater than 200kb. // The '+' operator can also be used to combine two SearchCondition objects client.Download("/", @"C:\temp", new NameSearchCondition("*.exe") + new SizeSearchCondition(200 * 1024, long.MaxValue)); // Upload files starting with 'test' or ending with '.cs' or '.vb' and also larger than or equal to 1M client.Upload(@"C:\Test", "/", new AndSearchCondition(new NameSearchCondition("test*") | new NameSearchCondition("*.cs;*.vb"), new SizeSearchCondition(1024 * 1024, long.MaxValue)) ); // Close the connection. client.Disconnect();
Shows how to use AndSearchCondition to download files that have .exe extension and are greater than 200kb.
using System.IO; using ComponentPro.Compression; using ComponentPro.IO; ... // Create a new instance of the Zip class. Zip zip = new Zip(); // Open an existing file. zip.Open("test.zip"); // Download files that have '.exe' extension and are greater than 200kb from the remote root dir. TransferOptions opt = new TransferOptions(); // '.exe' extension and size greater than 200kb. // This equals to // opt.SearchCondition = new AndSearchCondition(new NameSearchCondition("*.exe"), new SizeSearchCondition(200*1024, long.MaxValue)); opt.SearchCondition = new NameSearchCondition("*.exe") & new SizeSearchCondition(200*1024, long.MaxValue); zip.ExtractFiles("/", @"C:\temp", opt); // Extract files that have size greater than 50kb and are not hidden. opt = new TransferOptions(); opt.SearchCondition = new SizeSearchCondition(50 * 1024, long.MaxValue) + new NotSearchCondition(new AttributeSearchCondition(FileAttributes.Hidden)); zip.ExtractAll(@"c:\temp", opt); // Close the connection. zip.Close();