Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Issues with filemask

If you want to download one specific file only, just name it in the GetFiles call:
session.GetFiles("/Build/TESTING/B.rtf", ....)

See https://winscp.net/eng/docs/library_session_getfiles#remotepath

No FileMask is needed. Though the "B.rtf|*/" (and the like) should work too. If it does not, we need a session log file to investigate.
mike3145

Issues with filemask

I'm having troubles getting the filemask to work properly. I hope you can see my error.

Using ListDirectory("/Build/TESTING"), I see this file/folder structure:

/Build/TESTING/.
/Build/TESTING/..
/Build/TESTING/.DS_Store
/Build/TESTING/A.rtf
/Build/TESTING/Alpha
/Build/TESTING/B.rtf
/Build/TESTING/Beta
/Build/TESTING/Omega

A.rtf and B.rtf are files
Alpha, Beta and Omega are folders

I'm trying to download B.rtf only. Here are examples of what I have tried.
options.FileMask = "B.rtf|*/"; //nothing copied
options.FileMask = "B.rtf | */"; //nothing copied
options.FileMask = "B.rtf; | */"; //nothing copied
options.FileMask = "B.rtf;|*/"; //nothing copied
options.FileMask = "B.rtf"; // B.rtf plus subfolders downloaded
options.FileMask = "|*/"; // nothing copied
options.FileMask = "| */"; // nothing copied
options.FileMask = "* | */"; // nothing copied
options.FileMask = "*.rtf | */"; // nothing copied
options.FileMask = ""; // all files and folders are copied

What is the correct filemask to only download B.rtf?

Thanks in advance.