Topic "Unable to get 'put' script to work"

Author Message
dubscat01
[View user's profile]

Joined: 2014-04-04
Posts: 1
hello, and thanks in advance -

winscp version: 5.5.2 (build 4130)
windows 2010
protocal: FTP

i am trying to upload a .txt file, and i've templated a script off the example posted here:
http://winscp.net/forum/viewtopic.php?t=6767

the script generates the following strShell string:

"C:\Program Files (x86)\WinSCP\WinSCP.exe" userID:password@host.url "put \\local drive\local folder\FTP_Upload_Test.txt /ftp path folder/sub-folder/" "close"

which i execute with: Shell strShell

problems:
1. i've set up the host login with the userID and password that i'm assigning in the strShell string, and can login manually with no problem; however when i execute the shell command, it initially follows the same login sequence, but then says "access denied" and then asks for the pw to be entered again.

2. re-entereing the pw does allow the login to proceed successfully, but the file transfer does not occur
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Your syntax is completely wrong. Please start here:
http://winscp.net/eng/docs/guide_automation
_________________
Martin Prikryl
Guest




prikryl wrote:
Your syntax is completely wrong. Please start here:
http://winscp.net/eng/docs/guide_automation


thank you for your response, martin -

ok, i've tried using both a .txt file ("example.txt") and invoking 'winscp.exe /console /script=example.txt', and, as above, using 'shell strShell'. i've reviewed the documentation as you mention, as well as the related examples, but still am simply unable to get it figured out. what/where, specifically, is my syntax wrong?

thanks again,
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
- You are missing /command parameter before the commands.
- You are missing open command.
- Your paths with spaces are not enclosed in double-quotes.
- You are missing (almost mandatory) option batch abort and option confirm off commands.

Using /script= is definitely better for you as the syntax in script file is simpler than on command line.
You probably want to avoid /console (after you finish debugging this) to avoid console window poping up.
_________________
Martin Prikryl
Guest




prikryl wrote:
- You are missing /command parameter before the commands.
- You are missing open command.
- Your paths with spaces are not enclosed in double-quotes.
- You are missing (almost mandatory) option batch abort and option confirm off commands.

Using /script= is definitely better for you as the syntax in script file is simpler than on command line.
You probably want to avoid /console (after you finish debugging this) to avoid console window poping up.



thanks again, martin -

ok, have reviewed again the documentation and tried to implement your suggestions (which i did see in the doc'n/examples). My strShell now is:

C:\Program Files (x86)\WinSCP\WinSCP.exe /command "option batch abort" "option confirm off" "open userID:password@xx.xx.xxxx" "put \\localDrive\localFolder\FTP_Upload_Test.txt /Monthly Reporting/2014/3-2014/" "exit"

as suggested, but this does not connect at all, now. i've also tried inserting '/console', and all possible iterations using c:\...\WinSCP.com without success.... May i ask, what should the exact string be? also, i'm not sure i understand the "paths with spaces" comment; have not seen double quotes around the files paths in any of the examples, else i'm misunderstanding(likely!).
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Quote:
as suggested, but this does not connect at all, now. i've also tried inserting '/console', and all possible iterations using c:\...\WinSCP.com without success.... May i ask, what should the exact string be? also, i'm not sure i understand the "paths with spaces" comment; have not seen double quotes around the files paths in any of the examples, else i'm misunderstanding(likely!).


Should be:
... "put \\localDrive\localFolder\FTP_Upload_Test.txt ""/Monthly Reporting/2014/3-2014/""" ...

See http://winscp.net/eng/docs/commandline#syntax
_________________
Martin Prikryl
Guest




prikryl wrote:
Quote:
as suggested, but this does not connect at all, now. i've also tried inserting '/console', and all possible iterations using c:\...\WinSCP.com without success.... May i ask, what should the exact string be? also, i'm not sure i understand the "paths with spaces" comment; have not seen double quotes around the files paths in any of the examples, else i'm misunderstanding(likely!).


Should be:
... "put \\localDrive\localFolder\FTP_Upload_Test.txt ""/Monthly Reporting/2014/3-2014/""" ...

See http://winscp.net/eng/docs/commandline#syntax



appreciate your help, martin, but simply unable to get this! Embarassed we'll just manually transfer the files for now - thanks again!
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