Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

Clyde91

WinSCP Not Applying ReplaceInvalidChars Transfer Option Via PowerShell Script

Thanks for the insight Martin. My intent was to add some error handling and recovery based on script demonstrated in WinSCP documentation. I will go with a more direct script for the time being in order to make use of the ReplaceInvalidChars option and work on a different method for error handling and recovery.
martin

Re: WinSCP Not Applying ReplaceInvalidChars Transfer Option Via PowerShell Script

The ReplaceInvalidChars affects only the files and folders created during the transfer. While you are creating the folder with the quote yourself in your code (using the New-Item cmdlet). I actually wonder how come the New-Item cmdlet does not fail and does not stop your script.

The RemotePath.TranslateRemotePathToLocal method does not do the replacement (it does not even have an access to the TransferOptions). This might be improved. I'll see if more people have this problem.
Clyde91

WinSCP Not Applying ReplaceInvalidChars Transfer Option Via PowerShell Script

Hello,
Firstly I would like to thank you for providing such a useful application. While I am having an issue with my script currently, I am finding WinSCP very useful.

My issue is that while syncing a fileshare with Box.com via WinSCP using a powershell script, I find that the script is not applying the ReplaceInvalidChars transfer option to what appears to be only the directories. If the directory does not have invalid characters yet the filename does, ReplaceInvalidChars transfer option works correctly. This does however work on both directories and filenames from GUI. My configuration is as follows:
WinSCP Version: 5.15.1 (Build 9407)
Windows Version: Server 2016
Transfer Protocol: FTPS
Transfer method: PowerShell script
Errors encounter: Log file attached
Script: attached

As this works from GUI but not my script, I am sure my script is the culprit. I am not great with powershell, and less than literate when it comes to .NET, so any assistance would be greatly appreciated.

Regards,
Clyde