Setting Filename modification Replace option in WinSCP .NET TransferSettings

133 views Asked by At

In the WinSCP application there is a check box in the Transfer settings dialog to indicate if certain filename characters should be replaced when a file is transferred.

It's the Replace check box in the Filename modification group.

WinSCP Transfer settings dialog

Where is this option in C# WinSCP.net? I've looked on the WinSCP.TransferOptions class, but I can't see this option.

Can someone please tell me how I set the File Modification Replace option in WinSCP .NET?

1

There are 1 answers

1
Martin Prikryl On BEST ANSWER

Use ReplaceInvalidChars raw transfer setting:

var options = new TransferOptions();
options.AddRawSettings("ReplaceInvalidChars", "0");

And then use the TransferOptions instance when calling file transfer method (such as Session.PutFiles).

WinSCP GUI can even generate the code for you.