当使用 WinSCP 选择要上传到 FTP 服务器的文件的掩码不匹配任何文件时,SSIS 任务失败 [英] Fail SSIS task when the mask to select files to be uploaded to FTP server using WinSCP matches no files

查看:25
本文介绍了当使用 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 ...

这篇关于当使用 WinSCP 选择要上传到 FTP 服务器的文件的掩码不匹配任何文件时,SSIS 任务失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆