public class NotSearchCondition : SearchCondition
Shows how to use the NotSearchCondition class to upload files that are not hidden
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"); // Download all files that are not hidden. // The '!' (not) operator can also be used to reverse a condition client.Upload(@"C:\temp", "/", !new AttributeSearchCondition(FileAttributes.Hidden)); // Upload files not starting with 'test' nor 'real' client.Upload(@"C:\Test", "/", new NotSearchCondition(new OrSearchCondition( new NameSearchCondition("test*"), new NameSearchCondition("real*"))) ); // Close the connection. client.Disconnect();
Shows how to use the NotSearchCondition class to upload files that are not hidden
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"); // Download all files that are not hidden. // The '!' (not) operator can also be used to reverse a condition client.Upload(@"C:\temp", "/", !new AttributeSearchCondition(FileAttributes.Hidden)); // Upload files not starting with 'test' nor 'real' client.Upload(@"C:\Test", "/", new NotSearchCondition(new OrSearchCondition( new NameSearchCondition("test*"), new NameSearchCondition("real*"))) ); // Close the connection. client.Disconnect();
Shows how to use NotSearchCondition to add files that are not hidden
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 all files that are not hidden. TransferOptions opt = new TransferOptions(); // This equals to // opt.SearchCondition = new AndSearchCondition(new NameSearchCondition("*.*"), new NotSearchCondition(new AttributeSearchCondition(FileAttributes.Hidden))); opt.SearchCondition = new NameSearchCondition("*.*") - new AttributeSearchCondition(FileAttributes.Hidden); zip.AddFiles(@"C:\temp", "/", opt); // Close the connection. zip.Close();