Topic "Spaces in file path throws errors"

Author Message
nbhfgq
[View user's profile]

Joined: 2010-11-10
Posts: 2
When trying to transfer from my local machine to a remote server... using automation

# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
# Connect
open dcl
# Change remote directory
cd /%1%
# Force binary mode transfer
option transfer binary
# Upload the file to current working directory
put %2%
# Disconnect
close
# Exit WinSCP
exit

c:\>winscp.com /script="C:\New Folder\testftp.txt" /parameter holds "C:\New Folder (2)\testUNC.txt"

. 2010-11-10 11:11:42.450 --------------------------------------------------------------------------
. 2010-11-10 11:11:42.451 WinSCP Version 4.2.9 (Build 938) (OS 6.0.6002 Service Pack 2)
. 2010-11-10 11:11:42.451 Login time: Wednesday, November 10, 2010 11:11:42 AM
. 2010-11-10 11:11:42.451 --------------------------------------------------------------------------
. 2010-11-10 11:11:42.451 Session name: dcl
. 2010-11-10 11:11:42.451 Host name: ftp.test.com (Port: 990)
. 2010-11-10 11:11:42.451 User name: dcl (Password: Yes, Key file: No)
. 2010-11-10 11:11:42.451 Tunnel: No
. 2010-11-10 11:11:42.451 Transfer Protocol: FTP
. 2010-11-10 11:11:42.451 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2010-11-10 11:11:42.451 Proxy: none
. 2010-11-10 11:11:42.451 FTP: FTPS: Implicit SSL/TLS; Passive: Yes [Force IP: No]
. 2010-11-10 11:11:42.451 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-11-10 11:11:42.451 Cache directory changes: Yes, Permanent: Yes
. 2010-11-10 11:11:42.451 DST mode: 1
. 2010-11-10 11:11:42.451 --------------------------------------------------------------------------
. 2010-11-10 11:11:43.059 Connecting to ftp.test.com:990 ...
. 2010-11-10 11:11:43.217 Connected with ftp.test.com:990, negotiating SSL connection...
. 2010-11-10 11:11:43.373 SSL connection established. Waiting for welcome message...
< 2010-11-10 11:11:43.373 220 Hello...now where to begin
> 2010-11-10 11:11:43.373 USER dcl
< 2010-11-10 11:11:43.394 331 Password required for dcl
> 2010-11-10 11:11:43.394 PASS *******
< 2010-11-10 11:11:43.415 230 Logged on
> 2010-11-10 11:11:43.415 SYST
< 2010-11-10 11:11:43.436 215 UNIX emulated by FileZilla
> 2010-11-10 11:11:43.436 FEAT
< 2010-11-10 11:11:43.459 211-Features:
< 2010-11-10 11:11:43.459 MDTM
< 2010-11-10 11:11:43.459 REST STREAM
< 2010-11-10 11:11:43.459 SIZE
< 2010-11-10 11:11:43.459 MLST type*;size*;modify*;
< 2010-11-10 11:11:43.460 MLSD
< 2010-11-10 11:11:43.460 AUTH SSL
< 2010-11-10 11:11:43.460 AUTH TLS
< 2010-11-10 11:11:43.460 PROT
< 2010-11-10 11:11:43.460 PBSZ
< 2010-11-10 11:11:43.460 UTF8
< 2010-11-10 11:11:43.460 CLNT
< 2010-11-10 11:11:43.460 MFMT
< 2010-11-10 11:11:43.460 211 End
> 2010-11-10 11:11:43.460 PBSZ 0
< 2010-11-10 11:11:43.481 200 PBSZ=0
> 2010-11-10 11:11:43.481 PROT P
< 2010-11-10 11:11:43.506 200 Protection level set to P
. 2010-11-10 11:11:43.509 Connected
. 2010-11-10 11:11:43.509 --------------------------------------------------------------------------
. 2010-11-10 11:11:43.509 Using FTP protocol.
. 2010-11-10 11:11:43.509 Doing startup conversation with host.
> 2010-11-10 11:11:43.521 PWD
< 2010-11-10 11:11:43.542 257 "/" is current directory.
. 2010-11-10 11:11:43.544 Getting current directory name.
. 2010-11-10 11:11:43.545 Startup conversation with host finished.
< 2010-11-10 11:11:43.547 Script: Active session: [1] dcl
> 2010-11-10 11:11:43.550 Script: cd /holds
. 2010-11-10 11:11:43.550 Cached directory change via "/holds" to "/holds".
. 2010-11-10 11:11:43.550 Getting current directory name.
< 2010-11-10 11:11:43.550 Script: /holds
> 2010-11-10 11:11:43.553 Script: option transfer binary
< 2010-11-10 11:11:43.553 Script: transfer binary
> 2010-11-10 11:11:43.574 Script: put C:\New Folder (2)\testUNC.txt
. 2010-11-10 11:11:43.574 Copying 2 files/directories to remote directory "/holds"
. 2010-11-10 11:11:43.574 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask: (2)\testUNC.txt
. 2010-11-10 11:11:43.574 TM: B; ClAr: No; CPS: 0; ExclM(No):
. 2010-11-10 11:11:43.575 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-11-10 11:11:43.575 File: "C:\New"
* 2010-11-10 11:11:43.575 (EOSError) System Error. Code: 2.

* 2010-11-10 11:11:43.575 The system cannot find the file specified
. 2010-11-10 11:11:43.575 Asking user:
. 2010-11-10 11:11:43.575 File or folder 'C:\New' does not exist. ("System Error. Code: 2.

. 2010-11-10 11:11:43.575 The system cannot find the file specified")
* 2010-11-10 11:11:43.584 (EScpSkipFile) File or folder 'C:\New' does not exist.
* 2010-11-10 11:11:43.584 System Error. Code: 2.
* 2010-11-10 11:11:43.584 The system cannot find the file specified
. 2010-11-10 11:11:43.584 Script: Failed
> 2010-11-10 11:11:43.585 Script: close
. 2010-11-10 11:11:43.587 Disconnected from server

I tried to use double-double quotes and it failed as well...

c:\>winscp.com /script="C:\New Folder\testftp.txt" /parameter holds ""C:\New Folder (2)\testUNC.txt""

. 2010-11-10 11:31:47.053 --------------------------------------------------------------------------
. 2010-11-10 11:31:47.053 WinSCP Version 4.2.9 (Build 938) (OS 6.0.6002 Service Pack 2)
. 2010-11-10 11:31:47.053 Login time: Wednesday, November 10, 2010 11:31:47 AM
. 2010-11-10 11:31:47.053 --------------------------------------------------------------------------
. 2010-11-10 11:31:47.053 Session name: dcl
. 2010-11-10 11:31:47.053 Host name: ftp.test.com (Port: 990)
. 2010-11-10 11:31:47.053 User name: dcl (Password: Yes, Key file: No)
. 2010-11-10 11:31:47.053 Tunnel: No
. 2010-11-10 11:31:47.053 Transfer Protocol: FTP
. 2010-11-10 11:31:47.053 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2010-11-10 11:31:47.053 Proxy: none
. 2010-11-10 11:31:47.053 FTP: FTPS: Implicit SSL/TLS; Passive: Yes [Force IP: No]
. 2010-11-10 11:31:47.053 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-11-10 11:31:47.053 Cache directory changes: Yes, Permanent: Yes
. 2010-11-10 11:31:47.053 DST mode: 1
. 2010-11-10 11:31:47.054 --------------------------------------------------------------------------
. 2010-11-10 11:31:47.672 Connecting to ftp.test.com:990 ...
. 2010-11-10 11:31:47.732 Connected with ftp.test.com:990, negotiating SSL connection...
. 2010-11-10 11:31:47.889 SSL connection established. Waiting for welcome message...
< 2010-11-10 11:31:47.889 220 Hello...now where to begin
> 2010-11-10 11:31:47.889 USER dcl
< 2010-11-10 11:31:47.911 331 Password required for dcl
> 2010-11-10 11:31:47.911 PASS *******
< 2010-11-10 11:31:47.932 230 Logged on
> 2010-11-10 11:31:47.932 SYST
< 2010-11-10 11:31:47.953 215 UNIX emulated by FileZilla
> 2010-11-10 11:31:47.953 FEAT
< 2010-11-10 11:31:47.976 211-Features:
< 2010-11-10 11:31:47.976 MDTM
< 2010-11-10 11:31:47.976 REST STREAM
< 2010-11-10 11:31:47.976 SIZE
< 2010-11-10 11:31:47.976 MLST type*;size*;modify*;
< 2010-11-10 11:31:47.976 MLSD
< 2010-11-10 11:31:47.976 AUTH SSL
< 2010-11-10 11:31:47.976 AUTH TLS
< 2010-11-10 11:31:47.976 PROT
< 2010-11-10 11:31:47.976 PBSZ
< 2010-11-10 11:31:47.976 UTF8
< 2010-11-10 11:31:47.977 CLNT
< 2010-11-10 11:31:47.977 MFMT
< 2010-11-10 11:31:47.977 211 End
> 2010-11-10 11:31:47.977 PBSZ 0
< 2010-11-10 11:31:47.997 200 PBSZ=0
> 2010-11-10 11:31:47.998 PROT P
< 2010-11-10 11:31:48.019 200 Protection level set to P
. 2010-11-10 11:31:48.021 Connected
. 2010-11-10 11:31:48.021 --------------------------------------------------------------------------
. 2010-11-10 11:31:48.021 Using FTP protocol.
. 2010-11-10 11:31:48.022 Doing startup conversation with host.
> 2010-11-10 11:31:48.024 PWD
< 2010-11-10 11:31:48.046 257 "/" is current directory.
. 2010-11-10 11:31:48.048 Getting current directory name.
. 2010-11-10 11:31:48.048 Startup conversation with host finished.
< 2010-11-10 11:31:48.051 Script: Active session: [1] dcl
> 2010-11-10 11:31:48.054 Script: cd /holds
. 2010-11-10 11:31:48.054 Cached directory change via "/holds" to "/holds".
. 2010-11-10 11:31:48.054 Getting current directory name.
< 2010-11-10 11:31:48.054 Script: /holds
> 2010-11-10 11:31:48.058 Script: option transfer binary
< 2010-11-10 11:31:48.058 Script: transfer binary
> 2010-11-10 11:31:48.061 Script: put "C:\New
. 2010-11-10 11:31:48.062 Copying 1 files/directories to remote directory "/holds"
. 2010-11-10 11:31:48.062 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask:
. 2010-11-10 11:31:48.062 TM: B; ClAr: No; CPS: 0; ExclM(No):
. 2010-11-10 11:31:48.062 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-11-10 11:31:48.062 File: "C:\New "
* 2010-11-10 11:31:48.063 (EOSError) System Error. Code: 2.

* 2010-11-10 11:31:48.063 The system cannot find the file specified
. 2010-11-10 11:31:48.063 Asking user:
. 2010-11-10 11:31:48.063 File or folder 'C:\New ' does not exist. ("System Error. Code: 2.

. 2010-11-10 11:31:48.063 The system cannot find the file specified")
* 2010-11-10 11:31:48.073 (EScpSkipFile) File or folder 'C:\New ' does not exist.
* 2010-11-10 11:31:48.073 System Error. Code: 2.
* 2010-11-10 11:31:48.073 The system cannot find the file specified
. 2010-11-10 11:31:48.073 Script: Failed
> 2010-11-10 11:31:48.074 Script: close
. 2010-11-10 11:31:48.077 Disconnected from server

Then to be sure I removed the spaces... and it worked

c:\>winscp.com /script=C:\NewFolder\testftp.txt /parameter holds C:\NewFolder(2)\testUNC.txt

. 2010-11-10 11:35:38.283 --------------------------------------------------------------------------
. 2010-11-10 11:35:38.283 WinSCP Version 4.2.9 (Build 938) (OS 6.0.6002 Service Pack 2)
. 2010-11-10 11:35:38.283 Login time: Wednesday, November 10, 2010 11:35:38 AM
. 2010-11-10 11:35:38.283 --------------------------------------------------------------------------
. 2010-11-10 11:35:38.283 Session name: dcl
. 2010-11-10 11:35:38.283 Host name: ftp.test.com (Port: 990)
. 2010-11-10 11:35:38.283 User name: dcl (Password: Yes, Key file: No)
. 2010-11-10 11:35:38.283 Tunnel: No
. 2010-11-10 11:35:38.283 Transfer Protocol: FTP
. 2010-11-10 11:35:38.284 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2010-11-10 11:35:38.284 Proxy: none
. 2010-11-10 11:35:38.284 FTP: FTPS: Implicit SSL/TLS; Passive: Yes [Force IP: No]
. 2010-11-10 11:35:38.284 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-11-10 11:35:38.284 Cache directory changes: Yes, Permanent: Yes
. 2010-11-10 11:35:38.284 DST mode: 1
. 2010-11-10 11:35:38.284 --------------------------------------------------------------------------
. 2010-11-10 11:35:38.906 Connecting to ftp.test.com:990 ...
. 2010-11-10 11:35:38.964 Connected with ftp.test.com:990, negotiating SSL connection...
. 2010-11-10 11:35:39.075 SSL connection established. Waiting for welcome message...
< 2010-11-10 11:35:39.075 220 Hello...now where to begin
> 2010-11-10 11:35:39.075 USER dcl
< 2010-11-10 11:35:39.095 331 Password required for dcl
> 2010-11-10 11:35:39.095 PASS *******
< 2010-11-10 11:35:39.116 230 Logged on
> 2010-11-10 11:35:39.116 SYST
< 2010-11-10 11:35:39.136 215 UNIX emulated by FileZilla
> 2010-11-10 11:35:39.137 FEAT
< 2010-11-10 11:35:39.159 211-Features:
< 2010-11-10 11:35:39.159 MDTM
< 2010-11-10 11:35:39.159 REST STREAM
< 2010-11-10 11:35:39.159 SIZE
< 2010-11-10 11:35:39.160 MLST type*;size*;modify*;
< 2010-11-10 11:35:39.160 MLSD
< 2010-11-10 11:35:39.160 AUTH SSL
< 2010-11-10 11:35:39.160 AUTH TLS
< 2010-11-10 11:35:39.160 PROT
< 2010-11-10 11:35:39.160 PBSZ
< 2010-11-10 11:35:39.160 UTF8
< 2010-11-10 11:35:39.160 CLNT
< 2010-11-10 11:35:39.160 MFMT
< 2010-11-10 11:35:39.160 211 End
> 2010-11-10 11:35:39.160 PBSZ 0
< 2010-11-10 11:35:39.180 200 PBSZ=0
> 2010-11-10 11:35:39.180 PROT P
< 2010-11-10 11:35:39.201 200 Protection level set to P
. 2010-11-10 11:35:39.204 Connected
. 2010-11-10 11:35:39.204 --------------------------------------------------------------------------
. 2010-11-10 11:35:39.204 Using FTP protocol.
. 2010-11-10 11:35:39.205 Doing startup conversation with host.
> 2010-11-10 11:35:39.208 PWD
< 2010-11-10 11:35:39.230 257 "/" is current directory.
. 2010-11-10 11:35:39.232 Getting current directory name.
. 2010-11-10 11:35:39.232 Startup conversation with host finished.
< 2010-11-10 11:35:39.235 Script: Active session: [1] dcl
> 2010-11-10 11:35:39.241 Script: cd /holds
. 2010-11-10 11:35:39.241 Cached directory change via "/holds" to "/holds".
. 2010-11-10 11:35:39.241 Getting current directory name.
< 2010-11-10 11:35:39.242 Script: /holds
> 2010-11-10 11:35:39.246 Script: option transfer binary
< 2010-11-10 11:35:39.246 Script: transfer binary
> 2010-11-10 11:35:39.249 Script: put C:\NewFolder(2)\testUNC.txt
. 2010-11-10 11:35:39.250 Copying 1 files/directories to remote directory "/holds"
. 2010-11-10 11:35:39.250 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask:
. 2010-11-10 11:35:39.250 TM: B; ClAr: No; CPS: 0; ExclM(No):
. 2010-11-10 11:35:39.250 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-11-10 11:35:39.250 File: "C:\NewFolder(2)\testUNC.txt"
. 2010-11-10 11:35:39.251 Copying "C:\NewFolder(2)\testUNC.txt" to remote directory started.
. 2010-11-10 11:35:39.251 Binary transfer mode selected.
. 2010-11-10 11:35:39.261 Starting upload of C:\NewFolder(2)\testUNC.txt
> 2010-11-10 11:35:39.261 CWD /holds/
< 2010-11-10 11:35:39.282 250 CWD successful. "/holds" is current directory.
> 2010-11-10 11:35:39.282 PWD
< 2010-11-10 11:35:39.303 257 "/holds" is current directory.
> 2010-11-10 11:35:39.303 TYPE A
< 2010-11-10 11:35:39.323 200 Type set to A
> 2010-11-10 11:35:39.323 PASV
< 2010-11-10 11:35:39.344 227 Entering Passive Mode (xx,xx,xx,xx,15,59)
> 2010-11-10 11:35:39.345 LIST
< 2010-11-10 11:35:39.392 150 Connection accepted
. 2010-11-10 11:35:39.647 SSL connection established
< 2010-11-10 11:35:39.651 226 Transfer OK
> 2010-11-10 11:35:39.651 TYPE I
< 2010-11-10 11:35:39.672 200 Type set to I
> 2010-11-10 11:35:39.672 PASV
< 2010-11-10 11:35:39.693 227 Entering Passive Mode (xx,xx,xx,xx,15,60)
> 2010-11-10 11:35:39.693 STOR testUNC.txt
< 2010-11-10 11:35:39.740 150 Connection accepted
. 2010-11-10 11:35:40.060 SSL connection established
< 2010-11-10 11:35:40.085 226 Transfer OK
> 2010-11-10 11:35:40.085 MFMT 20101110184721 testUNC.txt
< 2010-11-10 11:35:40.107 213 modify=20101110184721; /holds/testUNC.txt
. 2010-11-10 11:35:40.107 Upload successful
> 2010-11-10 11:35:40.109 Script: close
. 2010-11-10 11:35:40.111 Disconnected from server[/i]
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Try
winscp.com /script="C:\New Folder\testftp.txt" /parameter holds "C:\New Folder (2)\testUNC.txt"
and
put "%2%"
_________________
Martin Prikryl
nbhfgq
[View user's profile]

Joined: 2010-11-10
Posts: 2
Much appreciated, issue resolved... now I know where the second set of double quotes should be placed.

If I may ask is this mentioned in any of the help?

Thanks... George
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
https://winscp.net/eng/docs/scripting#syntax
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License