Synchronize vs GetFiles C#
Here I am, after try alot of different thinks, asking you guys if someone could please help me.
Today I have this script:
And I am trying to do this Syncronize code, using C# as follow:
It start to download my files... but I have more than 100 files day, and I really don't want to download all of them everytime.
Today I have this script:
option batch on option confirm off open XXXX:YYYY@ZZZ.WWW.KKK.QQQ:7001 cd "ROOT" synchronize local "J:\FILES" "/ROOT/Jan"
// Setup session options SessionOptions sessionOptions = new SessionOptions { Protocol = Protocol.Sftp, HostName = Ip, UserName = User, Password = Pwd, PortNumber = Convert.ToInt32(Port), SshHostKey = "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" }; using (Session session = new Session()) { //Desabilita o check de versões session.DisableVersionCheck = true; // Will continuously report progress of synchronization session.FileTransferred += FileTransferred; // Connect session.Open(sessionOptions); RemoteDirectoryInfo directory = session.ListDirectory(cEntrada[0]); foreach (RemoteFileInfo fileInfo in directory.Files) { listBox1.Items.Add("Name: " + fileInfo.Name + " length:" + fileInfo.Length + " Permissions:" + fileInfo.FilePermissions + " Wrote in " + fileInfo.LastWriteTime); // **************************************************** // UNTIL HERE, IT IS OK! // **************************************************** //:arrow: It suppose to work as we have in WinScp example: SynchronizationResult synchronizationResult; synchronizationResult = session.SynchronizeDirectories(SynchronizationMode.Local, cEntrada[0], cSaida[0], false); synchronizationResult.Check(); // But Just didnt bring me anything.... :?: // In another hand, If I try TransferOperationResult transferResult; transferResult = session.GetFiles(cEntrada[0], cSaida[0], false); transferResult.Check();