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