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