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

t20

Exclude Multiple Folders from SFTP transfer

I have a session whose root directory contains multiple folder and file. I want to exclude two directories from transferring from the server directory.

Let's say /server/path/one and /server/path/two.

I am using the WinSCP NuGet package in VB.NET framework. Currently the code is as follows
Dim transferOptions As New TransferOptions
transferOptions.TransferMode = TransferMode.Binary
transferOptions.FileMask = $"/server/path/one/;/server/path/two/ | */"
transferOptions.AddRawSettings("NewerOnly", "1")
 
Dim transferResult As TransferOperationResult
transferResult = session.GetFiles($"{ServerDirectory}", $"{ClientDirectory}", False, transferOptions)

but when it runs it returns empty directories and does not transfer any of the file in neither the base nor the sub directories