Topic "Problem with %2% as remote dir param in "synchronize" script"

Author Message
rob26

Guest


Using WinSCP Version 5.0.0 (Build 1431)

Here is my script:

option batch abort
option confirm off
option transfer automatic
option reconnecttime 180
option exclude "*/"
open ftps://username:password@domain -passive -implicit
synchronize remote -mirror -criteria=time %1% %2%
exit

If I execute this at commandline:
WinSCP.com /timeout=180 /script="test.txt" /parameter "C:\path" "/path"

I get this returned (note that '%2%' did not resolve):

batch abort
confirm off
transfer automatic
reconnecttime 180
exclude */
Connecting to domain ...
Connected with domain:port, negotiating SSL connection...
SSL connection established. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] username@domain
Comparing...
Local 'C:\path' => Remote '%2%'
Error listing directory '%2%'.
Could not retrieve directory listing
CWD failed. "/%2%": directory not found.
(A)bort, (R)etry, (S)kip: Abort

If I execute this at commandline (note absence of "/" as first char of remote path):
WinSCP.com /timeout=180 /script="test.txt" /parameter "C:\path" "path"

I get this returned (note that '%2%' correctly resolved to remote 'path' this time):

batch abort
confirm off
transfer automatic
reconnecttime 180
exclude */
Connecting to domain ...
Connected with domain:port, negotiating SSL connection...
SSL connection established. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] username@domain
Comparing...
Local 'C:\path' => Remote 'path'
Synchronizing...

It appears that "/" as first character, when within quotes as in "/path" causes the second parameter not to resolve.
Advertisements
rob26

Guest


This problem only occurs when remote folder doesn't incude subfolders:
"/path" fails but "path" works

However:
"/path/folder" succeeds and "path/folder" fails.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
rob26 wrote:
This problem only occurs when remote folder doesn't incude subfolders:
"/path" fails but "path" works

However:
"/path/folder" succeeds and "path/folder" fails.

Exactly. Any argument with syntax /abc is considered a switch. In this case unrecognised switch.
I have just documented how to deal with that:
http://winscp.net/eng/docs/commandline#syntax

Last edited by martin on 2011-09-16; edited 1 time in total
Rob26

Guest


Martin, thanks for the the clear explanation and quick response.
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