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 包.
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 任务失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:当使用 WinSCP 选择要上传到 FTP 服务器的文件的掩码不匹配任何文件时,SSIS 任务失败
基础教程推荐
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 无法解决整理冲突 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 在 SQL 中连接多个表 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
