Syncing actively written host
Hi,
I'm trying to synchronize with a remote FTP host which is actively writing files to the remotePath. See code below:
This code will report:
Where
I'm wondering if there is any way to tell
I'm trying to synchronize with a remote FTP host which is actively writing files to the remotePath. See code below:
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(); }
This code will report:
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.
I'm wondering if there is any way to tell
session.SynchronizeDirectories
to ignore files which are actively being written or perhaps there is a different way to handle this situation?