当使用 WinSCP 选择要上传到 FTP 服务器的文件的掩码不匹配任何文件时,SSIS 任务失败

Fail SSIS task when the mask to select files to be uploaded to FTP server using WinSCP matches no files(当使用 WinSCP 选择要上传到 FTP 服务器的文件的掩码不匹配任何文件时,SSIS 任务失败)
本文介绍了当使用 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 任务失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)