title: Do not traverse directories using the WinSCP .NET assembly
body: <p>I am trying to upload the contents of a folder (but not the sub-folders, which have backup files, archive files and errored files) to a server using the <a href="https://en.wikipedia.org/wiki/WinSCP" rel="nofollow">WinSCP</a> .NET assembly. Is this even possible? If so, how do I do it?</p>
  
  <p>Quick code clip of my existing piece:</p>
  
  
  
  <pre class="lang-csharp prettyprint-override"><code>// string mode ...
  // Session sess ...
  // TransferOperationResult res ...
  
  TransferOptions tOpts = new TransferOptions();
  tOpts.FileMask = c.SearchPattern;
  tOpts.TransferMode = TransferMode.Binary;
  tOpts.PreserveTimestamp = true;
  
  SetMessage("Uploading files");
  res = sess.PutFiles(Path.Combine(c.LocalPath, c.SearchPattern),
                      c.RemotePath, 
                      c.DeleteAfterXFer, 
                      tOpts);
  </code></pre>
  
  <p>Is there some way of saying something to the effect of:</p>
  
  <pre class="lang-csharp prettyprint-override"><code>tOpts.TopDirectoryOnly = true
  </code></pre>
  
  <p>?</p>