Post a reply

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)


Topic review


No, it does not.

Martin, I will rephrase my request. Does EnumerateRemoteFiles of WinSCP has an option to Include/Exclude remote directories?

Re: EnumerateRemoteFiles with remote path mask

Sorry, but this is not a code writing service. This is not even a WinSCP question. It's mere question about filtering a string list. Please try yourself and ask questions about problems you face. Though your question would be more suitable for sites like But still, you need to try yourself even before asking there.

EnumerateRemoteFiles with remote path mask

Remote ftp structure
1. /ParentFolder/ChildFolderA/2021-03-20/ABC/
2. /ParentFolder/ChildFolderA/2021-03-19/ABC/
3. /ParentFolder/ChildFolderA/2021-03-18/ABC/
4. /ParentFolder/ChildFolderB/2021-03-20/DEF/
5. /ParentFolder/ChildFolderB/2021-03-19/DEF/
6. /ParentFolder/ChildFolderB/2021-03-18/DEF/
4. /ParentFolder/ChildFolderC/2021-03-20/GHI/
5. /ParentFolder/ChildFolderC/2021-03-19/GHI/
6. /ParentFolder/ChildFolderC/2021-03-18/GHI/

Please share a code snippet to session.EnumerateRemoteFiles with below filtering options of remote path
1. I should be able to include multiple directories such as ChildFolderA, ChildFolderC exluding ChildFolderB. I would prefer include over exclude because my include list will be small.
2. Along with above filter, I should have an additional filter by date range i.e. when I mention 2021-03-19, it should exclude till 2021-03-18 and include directories 2021-03-19, 2021-03-20 so on.

Expected result set for above filters
1. /ParentFolder/ChildFolderA/2021-03-20/ABC/
2. /ParentFolder/ChildFolderA/2021-03-19/ABC/
3. /ParentFolder/ChildFolderC/2021-03-20/GHI/
4. /ParentFolder/ChildFolderC/2021-03-19/GHI/

Note: I use C# and WinSCP latest stable vesion.