Multiple File Mask for WinSCP Session.EnumerateRemoteFiles
I am rebuilding the FTP part of a performance monitor application, should be able to upload any file with extensions
and when i try to customize this mask it returns 0 files, but if i select only one of them it works fine.
.csv .xlsx .xls
and when i try to customize this mask it returns 0 files, but if i select only one of them it works fine.
string FileMask = "*.csv; *.xlsx; *.xls"; var sessionOptions = new SessionOptions { Protocol = Protocol.Sftp, HostName = ConfigurationManager.AppSettings["FtpHost"], UserName = ConfigurationManager.AppSettings["FtpUsr"], Password = ConfigurationManager.AppSettings["FtpPwd"], SshHostKeyFingerprint = ConfigurationManager.AppSettings["SshHostKeyFingerprint"] }; using (Session session = new Session()) { session.Open(sessionOptions); List<string> files = session.EnumerateRemoteFiles("/", FileMask, EnumerationOptions.AllDirectories) .Select(fileInfo => fileInfo.FullName) .ToList(); Console.WriteLine($"Found {files.Count} files"); }
Last edited by febesuvu on 2021-05-04 05:57; edited 1 time in total