Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Works as expected

User error on my part, works well. thx Joe

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.

SynchronizeDirectories and FIlesTransferred callback

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

// Connect

// 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
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);