SynchronizationCriteria.Either Not Working As Expected

Advertisement

Woojo01
Joined:
Posts:
4
Location:
Florida

SynchronizationCriteria.Either Not Working As Expected

I have a daily scheduled process which downloads newer files from an FTP site. I recently ran into a problem whereby the FTP site had not been updated with new files. However, the process is still downloading the equal files even though I am using SynchronizationCriteria.Either for the synchronization. The WinSCP log reports the files as having the same time and the same size but the files are still selected as being "new".
Here is an excerpt of some relevant log entries. You can see the files have the same time and size.
. 2013-07-08 05:00:21.217 type=file;modify=20130702070747;size=9078; AGC_Procedures.zip.gpg
. 2013-07-08 05:00:21.220 Remote file '/SSIS_Extract/AGC_Procedures.zip.gpg' [2013-07-02T07:07:47.000Z] [9078] is new    
Here is the relevant portion of code used for the transfer:
using (Session session = new Session())
{
    if (SessionLogPath != null)
    {
   session.SessionLogPath = SessionLogPath;
    }
    // Will continuously report progress of synchronization
    session.FileTransferred += FileTransferred;

    // Connect
    session.Open(sessionOptions);

    SynchronizationResult synchronizationResult;

    synchronizationResult = session.SynchronizeDirectories(
       SynchronizationMode.Local, LocalDir, RemoteDir, false,false,SynchronizationCriteria.Either);

    // Throw on any error
    synchronizationResult.Check();
}    

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: SynchronizationCriteria.Either Not Working As Expected

Please attach a complete session log file showing the problem. Ideally on a small set of files (even just one).
_________________
Martin Prikryl

Reply with quote

Woojo01
Joined:
Posts:
4
Location:
Florida

Re: SynchronizationCriteria.Either Not Working As Expected

martin wrote:

Please attach a complete session log file showing the problem. Ideally on a small set of files (even just one).
Thank you for your very quick response!

My bad.... the local files were being deleted just prior to the synch. After making sure the local files are not deleted, the log was different in that it now showed files marked as local and the log also included a line with "Nothing to synchronize". The function IS working as expected.

Now for another question: Is there a result or way to determine, using the .NET assembly, if any files were synched and possibly how many? It would be good to know, from a result, whether or not any files were actually downloaded.

Thanks for a great product and excellent support!
--
JW

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: SynchronizationCriteria.Either Not Working As Expected

Woojo01 wrote:

Now for another question: Is there a result or way to determine, using the .NET assembly, if any files were synched and possibly how many? It would be good to know, from a result, whether or not any files were actually downloaded.
You can tell that from result of Session.SynchronizeDirectories.
See https://winscp.net/eng/docs/library_synchronizationresult

Reply with quote

Advertisement

You can post new topics in this forum