Options

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

# Topic review

martin

## Re: SynchronizationMode Local with FileMask

The `TransferOptions` are 7th argument of `Session.SynchronizeDirectories`, not 5th.
https://winscp.net/eng/docs/library_session_synchronizedirectories

You either need to specific 5th and 6th arguments:
`session.SynchronizeDirectories(    SynchronizationMode.Local, @"C:\temp", "/folder1", false,    false, SynchronizationCriteria.Time, transOp);`

or use a named argument:
`session.SynchronizeDirectories(    SynchronizationMode.Local, @"C:\temp", "/folder1", false,    options = transOp);`
GerGer

`private void buttonReportsData_Click(object sender, EventArgs e){    label1.Visible = true;     try    {        // Setup session options        SessionOptions sessionOptions = new SessionOptions        {            Protocol = Protocol.Ftp,            HostName = "000.000.0.00",            UserName = "HomeBoy",            Password = "1234567",        };         using (Session session = new Session())        {                                          // Will continuously report progress of synchronization            //session.FileTransferred += FileTransferred;             // Connect            session.Open(sessionOptions);             while (true)            {                //string filemask = "*.txt";                 buttonReportsData.BackColor = Color.DarkSeaGreen;                buttonReportsData.Text = "Sync-Started";                label1.Text = "FTP Sync process Started";                 TransferOptions transOp = new TransferOptions();                transOp.FileMask = "*.txt";                transOp.TransferMode = TransferMode.Automatic;                 // Synchronize files                SynchronizationResult synchronizationResult;                synchronizationResult =                    session.SynchronizeDirectories(                        SynchronizationMode.Local, @"C:\temp", "/folder1", false, transOp);                 // Throw on any error                synchronizationResult.Check();            }        }    }    ...}`