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

martin

Re: some (not all) files with a percent character in the file name cause winscp script and GUI to ab

Yes, that's correct.
techracer

Re: some (not all) files with a percent character in the file name cause winscp script and GUI to ab

Martin, I tried the /rawtransfersettings param and ran several tests and the small percentage of files that had a % character in their filename that were failing to upload are now uploading successfully. Thanks again for your help. Here is a snippet of my new code; you can see the new line I added as the second line in my batch file:
"C:\1data\WinSCPPortable\WinSCP.com" ^
  /rawtransfersettings ReplaceInvalidChars=0 ^
  /log="C:\1data\WinSCPPortable\WinSCPlog_0_Aggregate_for_Offsite_folder_from_E.log" /ini=nul ^
  /command ^
    "open sftp://........

(edited by admin in 2022)
techracer

Re: some (not all) files with a percent character in the file name cause winscp script and GUI to ab

Thanks, Martin. I will try that soon and I will report back here so that others may benefit from what I learn.
martin

Re: some (not all) files with a percent character in the file name cause winscp script and GUI to abort

You want to set ReplaceInvalidChars to 0 (do not replace).
https://winscp.net/eng/docs/rawtransfersettings
(edited in 2022)
techracer

some (not all) files with a percent character in the file name cause winscp script and GUI to abort

WinSCP is a wonderful took and I regularly transfer hundreds of thousands of files with a WinSCP script, but it fails on some (but not all) files that have a % character in their name. I have confirmed this on several different computers. The source and target computers all run Windows 10. I am using the portable version of WinSCP 5.9.6 build 7601. When I rename the file to remove the % character, it always succeeds. I have tried to transfer this file using the GUI and get an error "The file path does not exist or is invalid. Error code 10."

I have looked through the documentation and forums and have been unable to find an answer.

Here is the script line that I use:
"synchronize -filemask=""|*thumbs.db"" remote -delete ""F:\02 robo of server shares\personal"" /""personal"""

Here is an example of a source file with a % character that it FAILS on:
F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures\dealersite%2Fimages%2Fbikersdreamatl%2Fvp1631878_2_large.jpg

Here is an example of a source file with a % character that it SUCCEEDS on; note that it actually has the same %2 string in the file name that the failed file has:
F:\02 robo of server shares\personal\Bernard_Jaeger\Bernie1\Forms\JTEKT forms\2012  Supplier Data FileFM-MA-180A%20-%20Supplier%20Data%20Sheet(1).xls

When I look in the log for the one that failed, the "Collecting synchronization list for local directory" section of the log shows this, which seems to show no problem:
. 2017-09-13 10:08:03.919 Collecting synchronization list for local directory 'F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures' and remote directory '/personal/Dennis_Johnson/My Pictures', mode = Remote, params = 0x3 (Delete, NoConfirmation), file mask = '|*thumbs.db'
. 2017-09-13 10:08:03.919 Local file 'F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures\dealersite%2Fimages%2Fbikersdreamatl%2Fvp1631878_2_large.jpg' [2010-10-05T16:17:56.117Z] [96275] included to synchronization
. 2017-09-13 10:08:03.959 Local file 'F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures\dealersite%2Fimages%2Fbikersdreamatl%2Fvp1631878_2_large.jpg' [2010-10-05T16:17:56.117Z] [96275] is new

When I look in the log for the one that failed, the "Synchronizing local directory" section of the log shows this, which seems to show the problem. It appears that WinSCP is trying to break the file name up into individual folders.
. 2017-09-13 10:13:34.725 Copying "F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures\dealersite%2Fimages%2Fbikersdreamatl%2Fvp1631878_2_large.jpg" to remote directory started.
. 2017-09-13 10:13:34.785 Cannot create remote file '/personal/Dennis_Johnson/My Pictures/dealersite/images/bikersdreamatl/vp1631878_2_large.jpg'. ("The file path does not exist or is invalid.

I've pasted the "Collecting synchronization list for local directory" and "Synchronizing local directory" sections below that are relevant to this failed file. Thanks in advance for any help you may be able to offer in this matter. :-)

COLLECTING...
. 2017-09-13 10:08:03.919 Collecting synchronization list for local directory 'F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures' and remote directory '/personal/Dennis_Johnson/My Pictures', mode = Remote, params = 0x3 (Delete, NoConfirmation), file mask = '|*thumbs.db'
. 2017-09-13 10:08:03.919 Local file 'F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures\dealersite%2Fimages%2Fbikersdreamatl%2Fvp1631878_2_large.jpg' [2010-10-05T16:17:56.117Z] [96275] included to synchronization
. 2017-09-13 10:08:03.959 Local file 'F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures\dealersite%2Fimages%2Fbikersdreamatl%2Fvp1631878_2_large.jpg' [2010-10-05T16:17:56.117Z] [96275] is new

SYNCHRONIZING...
. 2017-09-13 10:13:34.680 Synchronizing local directory 'F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures\' with remote directory '/personal/Dennis_Johnson/My Pictures/', params = 0x3 (Delete, NoConfirmation)
. 2017-09-13 10:13:34.705 Copying 1 files/directories to remote directory "/personal/Dennis_Johnson/My Pictures/"
. 2017-09-13 10:13:34.705   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: *.*
. 2017-09-13 10:13:34.705   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: |*thumbs.db; ResumeL: 0
. 2017-09-13 10:13:34.705   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2017-09-13 10:13:34.710 File: 'F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures\dealersite%2Fimages%2Fbikersdreamatl%2Fvp1631878_2_large.jpg' [2010-10-05T16:17:56.117Z] [96275]
< 2017-09-13 10:13:34.725 Script: Local 'F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures' => Remote '/personal/Dennis_Johnson/My Pictures'
. 2017-09-13 10:13:34.725 Copying "F:\02 robo of server shares\personal\Dennis_Johnson\My Pictures\dealersite%2Fimages%2Fbikersdreamatl%2Fvp1631878_2_large.jpg" to remote directory started.
. 2017-09-13 10:13:34.725 Binary transfer mode selected.
. 2017-09-13 10:13:34.725 Opening remote file.
> 2017-09-13 10:13:34.730 Type: SSH_FXP_OPEN, Size: 121, Number: 10801667
< 2017-09-13 10:13:34.730 Type: SSH_FXP_STATUS, Size: 47, Number: 10801164
. 2017-09-13 10:13:34.730 Discarding reserved response
< 2017-09-13 10:13:34.730 Type: SSH_FXP_STATUS, Size: 17, Number: 10801412
. 2017-09-13 10:13:34.730 Discarding reserved response
< 2017-09-13 10:13:34.745 Type: SSH_FXP_STATUS, Size: 62, Number: 10801667
< 2017-09-13 10:13:34.745 Status code: 10, Message: 10801667, Server: The file path does not exist or is invalid., Language: en
> 2017-09-13 10:13:34.755 Type: SSH_FXP_LSTAT, Size: 104, Number: 10801927
< 2017-09-13 10:13:34.780 Type: SSH_FXP_STATUS, Size: 62, Number: 10801927
< 2017-09-13 10:13:34.780 Status code: 10, Message: 10801927, Server: The file path does not exist or is invalid., Language: en
* 2017-09-13 10:13:34.780 (ETerminal) The file path does not exist or is invalid.
* 2017-09-13 10:13:34.780 Error code: 10
* 2017-09-13 10:13:34.780 Error message from server (en): The file path does not exist or is invalid.
. 2017-09-13 10:13:34.785 Asking user:
. 2017-09-13 10:13:34.785 Cannot create remote file '/personal/Dennis_Johnson/My Pictures/dealersite/images/bikersdreamatl/vp1631878_2_large.jpg'. ("The file path does not exist or is invalid.
. 2017-09-13 10:13:34.785 Error code: 10
. 2017-09-13 10:13:34.785 Error message from server (en): The file path does not exist or is invalid.")
< 2017-09-13 10:13:34.785 Script: Cannot create remote file '/personal/Dennis_Johnson/My Pictures/dealersite/images/bikersdreamatl/vp1631878_2_large.jpg'.
< 2017-09-13 10:13:34.785 Script: The file path does not exist or is invalid.
< 2017-09-13 10:13:34.785 Error code: 10
< 2017-09-13 10:13:34.785 Error message from server (en): The file path does not exist or is invalid.
* 2017-09-13 10:13:34.785 (EScpSkipFile) Cannot create remote file '/personal/Dennis_Johnson/My Pictures/dealersite/images/bikersdreamatl/vp1631878_2_large.jpg'.
* 2017-09-13 10:13:34.785 The file path does not exist or is invalid.
* 2017-09-13 10:13:34.785 Error code: 10
* 2017-09-13 10:13:34.785 Error message from server (en): The file path does not exist or is invalid.
. 2017-09-13 10:13:34.785 Script: Failed
. 2017-09-13 10:13:34.785 Script: Exit code: 1
. 2017-09-13 10:13:34.785 Closing connection.
. 2017-09-13 10:13:34.785 Sending special code: 12
. 2017-09-13 10:13:34.785 Sent EOF message