Represents a logical NOT operation on a FileComparer object.

      Syntax

      public class NotFileComparer : FileComparer

      Examples

      FTP Examples

      The NotFileComparer class can be used for the Upload and Download operations. The following example code demonstrates how to use the NotFileComparer class to create a logical NOT comparer from a file comparer.

      using ComponentPro.IO;
      using ComponentPro.Net;
      
      ...
      
      using (Ftp client = new Ftp())
      {
          // Connect to the FTP server. 
          client.Connect(MyFtpServer, MyFtpPort);
      
          // Authenticate. 
          client.Authenticate("test", "test");
      
          // Create a new instance of the TransferOptions. 
          TransferOptions opt = new TransferOptions();
      
          // Set transfer options 
          // Files with the same size and different modification date time will not be uploaded. 
          opt.Comparer = FileComparers.FileSizeComparer & !FileComparers.FileLastWriteTimeComparer; // Equivalent to 'new AndFileComparer(FileComparers.FileSizeComparer, new NotFileComparer(FileComparers.FileLastWriteTimeComparer, FileComparers.FileSizeComparer))' 
          opt.FileOverwriteMode = FileOverwriteMode.CustomCompare; // Indicates that the above Comparer is used. 
       
          // Upload files and subdirectories in "C:\test" to the current remote directory. 
          client.Upload(
              "c:\\test", // Source directory path 
              "", // Destination directory path - "" means current directory 
              opt
              );
      }

      The following example code demonstrates how to use the NotFileComparer class to create a logical NOT comparer from a file comparer in a Mirror operation.

      using ComponentPro.IO;
      using ComponentPro.Net;
      
      ...
      
      using (Ftp client = new Ftp())
      {
          // Connect to the FTP server. 
          client.Connect(MyFtpServer, MyFtpPort);
      
          // Authenticate. 
          client.Authenticate("test", "test");
      
          // Create a new instance of the MirrorOptions class. 
          QuickSyncOptions opt = new QuickSyncOptions();
      
          // Set mirror settings 
          // Files with the same size and different modification date time will not be processed. 
          opt.Comparer = FileComparers.FileSizeComparer & !FileComparers.FileLastWriteTimeComparer; // Equivalent to 'new AndFileComparer(FileComparers.FileSizeComparer, new NotFileComparer(FileComparers.FileLastWriteTimeComparer, FileComparers.FileSizeComparer))' 
          opt.Recursive = true;
      
          // Mirror folders. 
          client.QuickSynchronize(
              "", // Source directory path - "" means current remote dir 
              "c:\\test", // Destination directory path.                 
              true,
              // Source directory is master. It means contents of "c:\test" will be identical to the remote dir's. 
              opt
              );
      }

      SFTP Examples

      The NotFileComparer class can be used for the Upload and Download operations. The following example code demonstrates how to use the NotFileComparer class to create a logical NOT comparer from a file comparer.

      using ComponentPro.IO;
      using ComponentPro.Net;
      
      ...
      
      using (Sftp client = new Sftp())
      {
          // Connect to the SFTP server. 
          client.Connect(MySftpServer, MySftpPort);
      
          // Authenticate. 
          client.Authenticate("test", "test");
      
          // Create a new instance of the TransferOptions. 
          TransferOptions opt = new TransferOptions();
      
          // Set transfer options 
          // Files with the same size and different modification date time will not be uploaded. 
          opt.Comparer = FileComparers.FileSizeComparer & !FileComparers.FileLastWriteTimeComparer; // Equivalent to 'new AndFileComparer(FileComparers.FileSizeComparer, new NotFileComparer(FileComparers.FileLastWriteTimeComparer, FileComparers.FileSizeComparer))' 
          opt.FileOverwriteMode = FileOverwriteMode.CustomCompare; // Indicates that the above Comparer is used. 
       
          // Upload files and subdirectories in "C:\test" to the current remote directory. 
          client.Upload(
              "c:\\test", // Source directory path 
              "", // Destination directory path - "" means current directory 
              opt
              );
      }

      The following example code demonstrates how to use the NotFileComparer class to create a logical NOT comparer from a file comparer in a Mirror operation.

      using ComponentPro.IO;
      using ComponentPro.Net;
      
      ...
      
      using (Sftp client = new Sftp())
      {
          // Connect to the SFTP server. 
          client.Connect(MySftpServer, MySftpPort);
      
          // Authenticate. 
          client.Authenticate("test", "test");
      
          // Create a new instance of the MirrorOptions class. 
          QuickSyncOptions opt = new QuickSyncOptions();
      
          // Set mirror settings 
          // Files with the same size and different modification date time will not be processed. 
          opt.Comparer = FileComparers.FileSizeComparer & !FileComparers.FileLastWriteTimeComparer; // Equivalent to 'new AndFileComparer(FileComparers.FileSizeComparer, new NotFileComparer(FileComparers.FileLastWriteTimeComparer, FileComparers.FileSizeComparer))' 
          opt.Recursive = true;
      
          // Mirror folders. 
          client.QuickSynchronize(
              "", // Source directory path - "" means current remote dir 
              "c:\\test", // Destination directory path.                 
              true,
              // Source directory is master. It means contents of "c:\test" will be identical to the remote dir's. 
              opt
              );
      }

      ZIP Examples

      The NotFileComparer class can be used for the UploadFiles and ExtractFiles operations. The following example code demonstrates how to use the NotFileComparer class to create a logical NOT comparer from a file comparer.

      using ComponentPro.Compression;
      using ComponentPro.IO;
      
      ...
      
      using (Zip arc = new Zip())
      {
          // Create a new ZIP file. 
          arc.Create("myzip.zip");
      
          // Create a new instance of the TransferOptions. 
          TransferOptions opt = new TransferOptions();
      
          // Set transfer options 
          // Files with the same size and different modification date time will not be uploaded. 
          opt.Comparer = FileComparers.FileSizeComparer & !FileComparers.FileLastWriteTimeComparer;  // Equivalent to 'new AndFileComparer(FileComparers.FileSizeComparer, new NotFileComparer(FileComparers.FileLastWriteTimeComparer, FileComparers.FileSizeComparer))' 
          opt.FileOverwriteMode = FileOverwriteMode.CustomCompare; // Indicates that the above Comparer is used. 
       
          // Upload files and subdirectories in "C:\test" to the current remote directory. 
          arc.AddFiles(
              "c:\\test", // Source directory path 
              "", // Destination directory path - "" means current directory 
              opt
              );
      }

      The following example code demonstrates how to use the NotFileComparer class to create a logical NOT comparer from a file comparer in a Mirror operation.

      using ComponentPro.Compression;
      using ComponentPro.IO;
      
      ...
      
      using (Zip arc = new Zip())
      {
          // Open an existing ZIP file. 
          arc.Open("myzip.zip");
      
          // Create a new instance of the QuickSyncOptions class. 
          QuickSyncOptions opt = new QuickSyncOptions();
      
          // Set mirror settings 
          // Files with the same size and different modification date time will not be processed. 
          opt.Comparer = FileComparers.FileSizeComparer & !FileComparers.FileLastWriteTimeComparer;  // Equivalent to 'new AndFileComparer(FileComparers.FileSizeComparer, new NotFileComparer(FileComparers.FileLastWriteTimeComparer, FileComparers.FileSizeComparer))' 
          opt.Recursive = true;
      
          // Mirror folders. 
          arc.QuickSynchronize(
              "", // Source directory path - "" means current remote dir 
              "c:\\test", // Destination directory path.                 
              true, // Source directory is master. It means contents of "c:\test" will be identical to the remote dir's. 
              opt
              );
      }

      Inheritance Hierarchy

            ComponentPro.IO.ComponentPro.IO.NotFileComparer

      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)

      Portable Class Library for Windows Phone 8.1 and Windows 8.1 Store AppsPortable Class Library for Windows Phone 8.1 and Windows 8.1 Store Apps

      Supported version: 4.6.x and later
      Assembly: ComponentPro.FileSystem.WinPcl (in ComponentPro.FileSystem.WinPcl.dll)

      Universal Windows Platform (includes Windows 10 Mobile, Windows 10 Store Apps and Windows 10 IoT)Universal Windows Platform (includes Windows 10 Mobile, Windows 10 Store Apps and Windows 10 IoT)

      Supported version: 4.6.x and later
      Assembly: ComponentPro.FileSystem.Uwp (in ComponentPro.FileSystem.Uwp.dll)

      Xamarin AndroidXamarin Android

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

      Xamarin MacXamarin Mac

      Supported version: 2.0.x and later
      Assembly: ComponentPro.FileSystem.Mac (in ComponentPro.FileSystem.Mac.dll)

      Xamarin iOSXamarin iOS

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

      See Also