title: WinSCP .NET assembly: FileMask in Directory Synchronization not working
body: <p>Here is what I want to do in laymen terms first: I want to get files (and maybe some files only). If there are sub-directories, I want to get files in those sub-directories as well. I am using Visual C++/CLI to program, so I am using .net assembly.</p>
  
  <p>In WinSCP, that is to use <code>Session.SynchronizeDirectories()</code>. The last parameter is the <code>TransferOptions</code> (a class) and it is usually set to null. Basically that means every files will be transferred. If I create an object and set the property <code>string FileMask</code>, I should be able to transfer only certain files.</p>
  
  <p>So I change the <a href="http://winscp.net/eng/docs/library_session_synchronizedirectories#csharp" rel="nofollow">WinSCP <strong>C#</strong> example program</a> to:</p>
  
  <pre><code>using (Session session = new Session())
  {
      // Will continuously report progress of synchronization
      session.FileTransferred += FileTransferred;
  
      // Connect
      session.Open(sessionOptions);
  
      // Create a TransferOptions object
      TransferOptions tro = new TransferOptions();
      tro.FileMask = "*.txt";
      tro.TransferMode = TransferMode.Automatic;
  
      // Synchronize files
      SynchronizationResult synchronizationResult;
      synchronizationResult =
          session.SynchronizeDirectories(
               SynchronizationMode.Local, @"C:\temp\win", "/C/Users/peter/Documents/WinSCP5.5.1/",
               false, false, SynchronizationCriteria.Time, tro);
  
      // Throw on any error
      synchronizationResult.Check();
  }
  </code></pre>
  
  <p>When I run the program, <strong>everything</strong> in the current directory and sub-directories are transferred!</p>
  
  <p>Thinking I may be wrong in the specifying those options. I use the WinSCP program. (Can refer to picture in WinSCP web site <a href="http://winscp.net/eng/docs/ui_transfer_custom" rel="nofollow">Transfer Settings Dialog</a> page.) </p>
  
  <p>All options are clear except I enter the following for the File mask:
  <code>*.txt</code></p>
  
  <p>I click OK button to begin transfer. I have the preview option on. <strong>And I see only txt files selected, even the one in the sub-directories</strong>. </p>
  
  <p>So WinSCP program works, but not the API?</p>
  
  <p>[Edit] I am using version 5.5.2 of WinSCP assembly.</p>