Hi ,
new to WinSCP – been tasked with converting a file download command to SFTP.
The previous command was on FTP and works well however we need now to transition to SFTP.
The problem I have is the SFTP command I designed seems to have a syntax error which I cannot put my finger on. The error is
Too many parameters for command 'open'.
The existing FTP job does the connection and file download in one go which is how I want to keep as well when I do the job in SFTP.
What I have done is to take this previous command of FTP, and modified it to suit the SFTP.
The only differences are that I have to additionally supply hostkey in the command (and the SFTP address and the port are different but they were just changes).
Below is the old command and the new command.
Additional info, this command is run from within SQL Server stored procedure. However I don't think it matters as I get the same error message from command-line itself from windows.
FTP script (working)
pushd \\myserver\ftp\Wnscpfolder & winscp.com /command "open ftp://userid:Password@ftp2.company.com:21/Prod/Outbound" "get *.xml ""\\myserver\FTP\inbound\""" "exit"
Sftp script (not working)
pushd \\myserver\ftp\Wnscpfolder & winscp.com /command "open sftp:// userid:Password @sftp.company.com:22 -hostkey=""ecdsa-sha2-nbvf384 384 lkiyShgtreALXcfRBQRYyWdbjpokjy5/38ZOhyx/xds="" /Prod/Outbound" "get *.xml ""\\myserver\FTP\inbound\""" "exit"