WinSCP error when connecting to SFTP server

Advertisement

AccuroIT
Joined:
Posts:
1

WinSCP error when connecting to SFTP server

Dear WinSCP contributors,

Please note that I am encountering the attached error message when I try to run a script which basically tries to open an SFTP connection to a remote server, check for the latest files on the remote directory and downloads them to the local directory, ends the SFTP session, and then locally moves them individually to subfolders.

C:
cd "C:\Program Files (x86)\WinSCP"
winscp.com open sftp://xxyyzz:AABBCC:2055@192.168.1.10 -hostkey="ssh-rsa 2048 11:22:33:44:55:66:77:88:99"
get -filemask="*>=%TIMESTAMP#yyyy-mm-dd%" /xxyyzz/* D:\Interfaces\Mauritius\IWIN
close
move D:\Interfaces\Mauritius\IWIN\BS*.txt D:\Interfaces\Mauritius\IWIN\BS\Inbound
move D:\Interfaces\Mauritius\IWIN\CA*.txt D:\Interfaces\Mauritius\IWIN\CA
move D:\Interfaces\Mauritius\IWIN\CTR*.txt D:\Interfaces\Mauritius\IWIN\CTR\Inbound
move D:\Interfaces\Mauritius\IWIN\DIV*.txt D:\Interfaces\Mauritius\IWIN\DIV\Inbound
move D:\Interfaces\Mauritius\IWIN\STK.txt D:\Interfaces\Mauritius\IWIN\STK\Inbound
pause

Let me know if I have missed something important.

Thank you.

Regards,
Laurent

WinSCP-Error.jpg

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,390
Location:
Prague, Czechia

Re: WinSCP error when connecting to SFTP server

@horts is correct, it should be:
C:
cd "C:\Program Files (x86)\WinSCP"
winscp.com /command ^
    "open sftp://xxyyzz:AABBCC:2055@192.168.1.10 -hostkey=""ssh-rsa 2048 11:22:33:44:55:66:77:88:99""" ^
    "get -filemask=*>=%TIMESTAMP#yyyy-mm-dd% /xxyyzz/* D:\Interfaces\Mauritius\IWIN\" ^
    "close"
move D:\Interfaces\Mauritius\IWIN\BS*.txt D:\Interfaces\Mauritius\IWIN\BS\Inbound
move D:\Interfaces\Mauritius\IWIN\CA*.txt D:\Interfaces\Mauritius\IWIN\CA
move D:\Interfaces\Mauritius\IWIN\CTR*.txt D:\Interfaces\Mauritius\IWIN\CTR\Inbound
move D:\Interfaces\Mauritius\IWIN\DIV*.txt D:\Interfaces\Mauritius\IWIN\DIV\Inbound
move D:\Interfaces\Mauritius\IWIN\STK.txt D:\Interfaces\Mauritius\IWIN\STK\Inbound
pause

See See https://winscp.net/eng/docs/faq_batch_file#cmd

Reply with quote

Advertisement

You can post new topics in this forum