Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

Fredrik1976

Re: Problem downloading files from SFTP site with batch job

Thank you. I managed to get it to work
Fredrik1976

Problem downloading files from SFTP site with batch job

I am trying to download files from a SFTP site using a batch file. While it seems to be connecting to the SFTP site I get the following error:
Unknown command '^'.

The system cannot find the path specified.
'"exit"' is not recognized as an internal or external command,
operable program or batch file. 

My batch file looks like the below:
@echo off
"D:\Utilities\WinSCP\WinSCP.com" ^
/command ^
"open sftp://XXXXXXXXXXX/ -hostkey=""ssh-dss 1024 XXXXXXXXXXXXXXXXXXXXXX"" -privatekey=""D:\XXXXXXXXXXXXXXXXX"" -rawsettings ProxyMethod=2 ProxyHost=""XXXXXXXXXXXXX"" ProxyPort=XXXXXXXX" ^
"lcd D:\Import\"
"cd /ARS" ^
"get -delete ARS_LAST_MT* D:\Import\"
"exit"


ARS is the folder name of the SFTP site, and D:\Import\ is the folder name where I want to have my files downloaded. My files start with the name ARS_LAST_MT and have a timestamp to it. That's why I want to use a wildcard.

What am I doing wrongly here? I would be very thankful for any support.