Re: Syncing actively written host
Hi Martin, this seems to help. Thanks.
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
using (Session session = new Session())
{
// Will continuously report progress of synchronization
// Also copy to Syncdir after download 'File' is ready
session.FileTransferred += FileDownload;
// Will continuously report progress of transfer
session.FileTransferProgress += FileTransferProgress;
SessionOptions sessionOptions = new SessionOptions()
{
Protocol = Protocol.Ftp,
HostName = Host,
PortNumber = PortNumber,
UserName = User,
Password = Password
};
// Connect
session.Open(sessionOptions);
// Synchronize files from remote to destination (local)
SynchronizationResult synchronizationResult = session.SynchronizeDirectories(
SynchronizationMode.Local,
LocalPath,
RemotePath,
false,
false,
SynchronizationCriteria.Size,
new TransferOptions { ResumeSupport = new TransferResumeSupport() { State = TransferResumeSupportState.Smart } }
);
// Throw on any error
synchronizationResult.Check();
session.Close();
}
WinSCP.SessionRemoteException: Error transferring file 'file.txt'.
Copying files from remote side failed.
file.txt: No such file or directory
at WinSCP.OperationResultBase.Check()
at
file.txt
is the actively written file by the remote host.
session.SynchronizeDirectories
to ignore files which are actively being written or perhaps there is a different way to handle this situation?