ComponentPro UltimateFtp

      Synchronize files/directories with files/directories on another file system

      Language Filter: AllSend comments on this topic to ComponentPro

      It's also possible to synchronize remote files and directories on an SFTP server with files and directories on another file system other than the local disk system. The following code example demonstrates how to synchronize a remote directory with a ZIP folder without creating any temporary files or directories on local disk.

      // Connect to an SFTP file system. 
      using (Sftp client = new Sftp())
          client.Connect("", 2222);
          client.Authenticate("test", "test");
          // Open an existing zip file. 
          using (Zip zip = new Zip())
              Synchronizer sync = new Synchronizer();
              SyncOptions opt = new SyncOptions();
              opt.AutoConflictResolution = true;
              opt.TimeResolution = TimeResolution.Seconds;
              FileInfoBase masterFolder = client.CreateFileInfo("/myfolder", false);
              FileInfoBase targetFolder1 = zip.GetItemInfo(@"/folder1");
              // Synchronize directories. 
              sync.Synchronize(masterFolder, opt, null, masterFolder, targetFolder1);