Tracking which files are being added during sync

Advertisement

jpmcfeely
Joined:
Posts:
1
Location:
Derry

Tracking which files are being added during sync

I am using the SynchronizeDirectories method as shown in the code below. My question is there any way of tracking which files are added to the local directory so that it can be written to a log file?

My code is as follows:
SessionOptions sessionOptionsROI = new SessionOptions
{
Protocol = Protocol.Ftp,
FtpMode = FtpMode.Passive,
FtpSecure = FtpSecure.Explicit,
HostName = ConfigurationManager.AppSettings["HostName"].ToString(),
UserName = ConfigurationManager.AppSettings["ROIUsername"].ToString(),
Password = ConfigurationManager.AppSettings["ROIPassword"].ToString(),
};

using (Session sessionROI = new Session())
{
// Connect
sessionROI.Open(sessionOptionsROI);

sessionROI.SynchronizeDirectories(SynchronizationMode.Local, @"\\10.176.1.8\Project\Company\FTP\ROI\REPORTS\", "/REPORTS", false, false, SynchronizationCriteria.Time, null).Check();
}

I have added the FileTransferred method in the example here:
https://winscp.net/eng/docs/library_session_synchronizedirectories#reallife

But this method is never triggered

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,552
Location:
Prague, Czechia

Re: Tracking which files are being added during sync

jpmcfeely wrote:

I am using the SynchronizeDirectories method as shown in the code below. My question is there any way of tracking which files are added to the local directory so that it can be written to a log file?
The easiest way is to iterate SynchronizationResult.Downloads returned by Session.SynchronizeDirectories.
https://winscp.net/eng/docs/library_session_synchronizedirectories
https://winscp.net/eng/docs/library_synchronizationresult

I have added the FileTransferred method in the example here:
https://winscp.net/eng/docs/library_session_synchronizedirectories#reallife
It should be triggered. Show us the code that you have tried.

Reply with quote

Advertisement

You can post new topics in this forum