简体   繁体   English

WinSCP .net 程序集不支持包含文件掩码

[英]WinSCP .net assembly not honoring include file mask

I'm using WinSCP .net assembly to download some files off of a ftp server.我正在使用WinSCP .net assembly从 ftp 服务器下载一些文件。 I want to restrict the download to我想限制下载

  1. Only the top level directory, ie.只有顶级目录,即。 no sub directories没有子目录
  2. Only .csv files.csv文件

To accomplish this I'm using the include/exclude file masks为此,我使用了包含/排除文件掩码

TransferOptions transferOptions = new TransferOptions();
transferOptions.FileMask = "*.csv | */";

Now the exclude part of the search is working fine and it doesn't bring down any subdirectories but the include part doesn't work at all.现在搜索的排除部分工作正常,它不会关闭任何子目录,但包含部分根本不起作用。 It's not downloading any csv files in the root directory.它不会在根目录中下载任何 csv 文件。 Does anyone know what I'm missing here?有谁知道我在这里想念什么?

For anyone who ends up here, this never worked for me no matter what I tried.对于最终来到这里的任何人来说,无论我尝试什么,这对我都不起作用。

I ended up using the SynchronizationResult api instead, to achieve the same result.我最终使用SynchronizationResult api 来实现相同的结果。 The exact same wildcard worked without any problems with it完全相同的通配符工作没有任何问题

        TransferOptions transferOptions = new TransferOptions
            {
                TransferMode = TransferMode.Binary,
                FileMask = "*.csv|*/"
            };

            SynchronizationResult result =
                session.SynchronizeDirectories(SynchronizationMode.Local, localDirectoryPath, remoteDirectoryPath, false, options: transferOptions);

            result.Check();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM