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

gculbert70@gmail.com

Downloading files from different directories

Hello I am using the following script to download csv files from different directories on our sftp server to the same local directories. This works for the first three but then errors out on the last one for back orders. I am sure I have not structured something correctly here.
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\logs\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://tcvsftpstorageeastus2.ID:PW@tcvsftpstorageeastus2.blob.core.windows.net/ -hostkey=""ecdsa-sha2-nistp256 256 etc""" ^
    "get -latest /emeacrm/orders/*.csv C:\TEImport_Data\orders\" ^
   "get -latest /emeacrm/customers/*.csv C:\TEImport_Data\customers\" ^
"get -latest /emeacrm/materials/*.csv C:\TEImport_Data\materials\"
"get -latest /emeacrm/backorders/*.csv C:\TEImport_Data\backorders\"
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%