Topic "SynchronizationCriteria.Either Not Working As Expected"

Author Message
Woojo01
[View user's profile]

Joined: 2012-10-04
Posts: 4
Location: Florida
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.
Code:
. 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:
Code:
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();
}
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Please attach a complete session log file showing the problem. Ideally on a small set of files (even just one).
_________________
Martin Prikryl
Woojo01
[View user's profile]

Joined: 2012-10-04
Posts: 4
Location: Florida
prikryl 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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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 http://winscp.net/eng/docs/library_synchronizationresult
Woojo01
[View user's profile]

Joined: 2012-10-04
Posts: 4
Location: Florida
prikryl wrote:
You can tell that from result of Session.SynchronizeDirectories.
See http://winscp.net/eng/docs/library_synchronizationresult

Perfect! I looked at it in VS2012 Object Explorer and it has exactly what I need.
Thanks again!

--
JW
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License