ComponentPro UltimateZip

      AndSearchCondition Class

      See AlsoMembersMembers Options: Show AllLanguage Filter: AllSend comments on this topic to ComponentPro
      Represents a logical AND operation on a set of SearchCondition object.

      Syntax

      public class AndSearchCondition : SearchCondition

      Examples

      FTP Examples

      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();

      SFTP Examples

      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();

      ZIP Examples

      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();

      Inheritance Hierarchy

            ComponentPro.IO.ComponentPro.IO.AndSearchCondition

      Framework

      .NET Compact Framework.NET Compact Framework

      Supported version: 2.0, 3.5, and 3.9
      Assembly: ComponentPro.FileSystem.CF (in ComponentPro.FileSystem.CF.dll)

      .NET Framework.NET Framework

      Supported version: 2.0, 3.0, 3.5, 4.0, 4.5.x, 4.6.x and later
      Assembly: ComponentPro.FileSystem (in ComponentPro.FileSystem.dll)

      Xamarin AndroidXamarin Android

      Supported version: 2.3 and later
      Assembly: ComponentPro.FileSystem.Android (in ComponentPro.FileSystem.Android.dll)

      Xamarin iOSXamarin iOS

      Supported version: 5.1.x and later
      Assembly: ComponentPro.FileSystem.iOS (in ComponentPro.FileSystem.iOS.dll)

      See Also