Post a reply

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)


Topic review


Re: script with multiple get/put

Hi Martin,

thank you very much, that did the trick. I like to have some blank lines for readability/structure. I have just deleted them.

Re: script with multiple get/put

The "No file matching ‘*’ found" message is by default not an error, it does not abort the script.

The script does not continue, because you are not escaping the line breaks after the empty lines in your batch file.
It should be like:
    "put -delete DELIVIN* ./ " ^
    "echo ====================invoice====================" ^

In other words, the batch file would stops always, even if the files were found.

Script with multiple get/put


my task is to connect to an SFTP site, change local/external directory, put all files, change directories again, put all files etc.

Everything works fine, unless the source directory is empty, I'll get the message "No files matching ‘*’ found." and the script halts with a WinSCP prompt, so it won't continue with the next command.
I have set the batch on option.

Here's is my bat-file:
"C:\Program Files (x86)\WinSCP\" ^
  /log="E:\xc_prod\FTP\wam_ftp\Kunde.txt" /loglevel=1 /ini=nul ^
  /command ^
    "open sftp://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx^
    "option batch on" ^
   "echo ====================desadv====================" ^
    "lcd E:\xc_prod\FTP\wam_ftp\in\Kunde\desadv\" ^
    "cd ../DELIVIN" ^
    "put -delete DELIVIN* ./ " ^
   "echo ====================invoice====================" ^
    "lcd E:\xc_prod\FTP\wam_ftp\in\Kunde\invoice\" ^
    "cd ../INVIN" ^
    "put -delete INVIN* ./ " ^
   "echo ====================ordrsp====================" ^
    "lcd E:\xc_prod\FTP\wam_ftp\in\Kunde\ordrsp\" ^
    "cd ../ORDCONFIN" ^
    "put -delete ORD* ./ " ^
   "echo ====================orders====================" ^
    "lcd E:\xc_prod\Source\Application\incoming\" ^
    "cd ORDOUT" ^
    "get -delete ORDOUT* ./ " ^
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error