Topic "WInSCP Copies subdirectories, even with the exclude FileMask"

Author Message
jerryhanel

Guest


I am using Version 1.1.4.3839 of the WinSCPnet.dll. In my code, I have the following lines:

TransferOptions tOpts = new TransferOptions();
tOpts.FileMask = "*/";

TransferOperationResult res = sess.PutFiles("S:\\TRANSFER_ME\\*.csv", c.RemotePath, false, tOpts);


Using this code, it SHOULD copy only the root level CSV files. Instead, it copies all CSV files, including those in the "processed" subfolder, which I don't want it to do. Is there any way to copy only the files and not subfolders?? I do not want to copy recursively.
jerryhanel

Guest


The answer is in the file mask, but the documentation doesn't have it exactly correct. The Exact answer is actually in the footnotes of the documentation page, not in the main documentation page.

FileMask consists of file patterns on two sides of a pipe character. If no pipe character is included, it is assumed to all be left-hand side.

Code:
(include masks) | (exclude masks)


When I was doing exactly as the docs said, I was explicitly declaring an INCLUDE mask, not an EXCLUDE mask. Changing my filemask to :

tOpts.FileMask = c.SearchPattern + "|*/";

solved the issue.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License