Unable to sftp file: TEST.%7C

Advertisement

NottaSmartMan
Joined:
Posts:
39

Unable to sftp file: TEST.%7C

When I try to transfer file TEST.%7C via PowerShell script (via the SynchronizeDirectories command), I get an error that TEST.| fails.

Looks like the hex code at the end of the filename is causing problems. Is there a solution for this? I can transfer the file fine if I use Windows' built in CLI SFTP program, but it fails with WinSCP.

I've tried adding the line $transferOptions.AddRawSettings("ReplaceInvalidChars", "1") to my code, but the script continue to try and upload the file as TEST.|.

Reply with quote

Advertisement

NottaSmartMan
Joined:
Posts:
39

Here's a sample/sanitized log file snippet showing that ReplaceInvalidChars is set to 1 and the error during copy:
> 2024-10-15 20:40:14.165 Script: synchronize remote -delete -mirror -nopermissions -preservetime -transfer="binary" -filemask="|*\testfolder\" -resumesupport="off" -rawtransfersettings[1] ReplaceInvalidChars="1" -criteria="time,size"  -- "C:\LocalFolder" "/RemoteFolder"
 
Copying 1 files/directories to remote directory "/RemoteFolder/Problem files/" - total size: 0
. 2024-10-15 20:40:18.484 File: 'C:\LocalFolder\Problem files\Test.%7C' [2024-10-14T19:25:30.075Z] [0]
. 2024-10-15 20:40:18.485 Copying "C:\LocalFolder\Problem files\Test.%7C" to remote directory started.
* 2024-10-15 20:40:18.601 (ETerminal) General failure (server should provide error description).
* 2024-10-15 20:40:18.601 Error code: 4
* 2024-10-15 20:40:18.601 Error message from server (en-US): 
* 2024-10-15 20:40:18.601 
* 2024-10-15 20:40:18.601 Common reasons for the Error code 4 are:
* 2024-10-15 20:40:18.601 - Renaming a file to a name of already existing file.
* 2024-10-15 20:40:18.601 - Creating a directory that already exists.
* 2024-10-15 20:40:18.601 - Moving a remote file to a different filesystem (HDD).
* 2024-10-15 20:40:18.601 - Uploading a file to a full filesystem (HDD).
* 2024-10-15 20:40:18.601 - Exceeding a user disk quota.
. 2024-10-15 20:40:18.601 Asking user:
. 2024-10-15 20:40:18.601 Cannot create remote file '/RemoteFolder/Problem files/[b]Test.|[/b]'. ("General failure (server should provide error description).
. 2024-10-15 20:40:18.601 Error code: 4
. 2024-10-15 20:40:18.601 Error message from server (en-US):
WinSCP changed %37C to a | symbol and tried to create that as a remote file.

Reply with quote

Advertisement

You can post new topics in this forum