SynchronizeDirectories and FIlesTransferred callback

Advertisement

jlavalle
Joined:
Posts:
1
Location:
United States

SynchronizeDirectories and FIlesTransferred callback

Here is call
using (Session session = new Session())
{
// Will continuously report progress of synchronization
session.FileTransferred += FileTransferred;

// Connect
session.Open(sessionOptions);

// Synchronize files
SynchronizationResult synchronizationResult;
TransferOptions synOptions = new TransferOptions();
synOptions.FileMask = filemask;

synchronizationResult = session.SynchronizeDirectories(SyncMode, destinationfolder, sourcefolder, false, false, WinSCP.SynchronizationCriteria.None, synOptions);
// Throw on any error
synchronizationResult.Check();
}
I would expect FilesTransferred to fire ever time a file is transferred, that does not happen. Seems like it may be asynchronous and happens too quickly?

private static void FileTransferred(object sender, TransferEventArgs e)
{ //** I only get 1 or 2 filenames here, when 10 have transferred
if (e.Error == null)
{
Console.WriteLine("Transfer of {0} succeeded", e.FileName);
}
}

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: SynchronizeDirectories and FIlesTransferred callback

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum