Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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
AccuroIT

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