当使用 WinSCP 选择要上传到 FTP 服务器的文件的掩码不匹配任何文件时,SSIS 任务失败
我正在创建一个使用脚本任务(通过 WinSCP)将文件上传到 FTP 的 SSIS 包.
I'm creating a SSIS package that uses a script task (via WinSCP) to upload a file to an FTP.
上传工作正常,但是如果没有上传文件,我需要该过程失败(目前它只是循环并通过成功) - 没有任何运气获得在 WinSCP 命令文件中编写脚本的帮助.
The upload works fine, however I need the process to fail if there is no file uploaded (currently it just loops through and passes a success) - Haven't had any luck getting help on scripting it in the WinSCP command file.
option batch on
option confirm off
open ftps://username:password@ftpsaddress/ -implicit -certificate="xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
cd "/DIR/"
option transfer binary
put \SERVERReports_BackUpSFTP*.csv -nopermissions -nopreservetime
close
exit
所以我的逻辑是在进程任务运行之前建立一个预运行文件检查进程.文件名变化很大,但它始终是 .csv.这就是我被困的地方.我需要添加一个任务来检查 .csv 文件是否存在,然后在此基础上传递失败或成功.
So my logic is to build a pre-run file check process before the process task runs. the file name varies greatly however it will always be a .csv. This is where I'm stuck. I need to add a task in that checks that a .csv file is there and then pass a fail or success on that basis.
推荐答案
假设 SSIS 监视进程退出代码,您可以使用 option failonnomatch on
:
Assuming SSIS monitors process exit code, you can make WinSCP return exit code 1 by using option failonnomatch on
:
option failonnomatch on
put ...
相关文章