'How to avoid trailing space being replaced with %20 when downloading a file with WinSACP

I use WinSCP script to download a file from an SFTP site. The file has length of trailing space after the file name.

After it is downloaded to local computer %20 is appended to the file name. For example, file.txt_________ becomes file.txt________%20 on local computer (_ stands for space).

Could you know any command I can put on the WinSCP script to remove it. Thank you in advance.



Solution 1:[1]

Add -rawtransfersettings ReplaceInvalidChars=0 to your get command:

get file directory\ -rawtransfersettings ReplaceInvalidChars=0

Read about raw transfer options.

You will lose the trailing spaces though, this way.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1