public class TimeSearchCondition : SearchCondition
Shows how to use the OrSearchCondition class to upload files with names ending with '.vb' or '.cs'.
using System.IO; 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"); // Upload files starting with 'best' or ending with '.cs' or '.vb'. client.Upload(@"C:\Test", "/", new NameSearchCondition("best*") | new NameSearchCondition("*.cs;*.vb")); // 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 OrSearchCondition class to upload files with names ending with '.vb' or '.cs'.
using System.IO; 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"); // Upload files starting with 'best' or ending with '.cs' or '.vb'. client.Upload(@"C:\Test", "/", new NameSearchCondition("best*") | new NameSearchCondition("*.cs;*.vb")); // 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 OrSearchCondition to add files with names ending with '.vb' or '.cs'.
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"); TransferOptions opt = new TransferOptions(); // Files with names starting with 'best' or ending with '.cs' or '.vb'. // This equals to: // opt.SearchCondition = new OrSearchCondition(new NameSearchCondition("best*"), new NameSearchCondition("*.cs;*.vb")); opt.SearchCondition = new NameSearchCondition("best*") | new NameSearchCondition("*.cs;*.vb"); zip.AddFiles(@"C:\Test", "/", opt); // Close the connection. zip.Close();