Post a reply

Options
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)

Options

Topic review

joseph.lavalle@...

Works as expected

User error on my part, works well. thx Joe
martin

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.
jlavalle

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