使用SSIS中的Winscp将文件从FTP下载到本地服务器的问题

时间:2018-02-15 16:56:48

标签: ssis ssis-2012 winscp winscp-net ssis-2017

我无法使用SSIS(执行进程任务)和Winscp下载任何文件。 我跟随各种论坛,并能够创建一个SSIS包。我不确定我哪里出错了。

  

我遵循的步骤: -

 Execute Process Task :- 
i) In Executable I wrote "C:\Program Files (x86)\WinSCP\WinSCP.exe"
ii)In Arguments :- /script=C:\Users\abcd\Desktop\efgh\remotelocal.txt
iii) Working directory :- C:\Users\abcd\Desktop\efgh (I believe this is required for the location where file needs to be saved)

在Remotelocal.txt中我有以下脚本: -

option batch abort
option confirm off
open ftpes://ghteyeriygvs:%69%315694598665@00.000.000.000/ (this is dummy value)
option transfer binary
cd ./wfgh/
get *.* C:\Users\abcd\Desktop\egfh
close
exit

在执行此程序包时出现以下错误

  

[执行进程任务]错误:执行“C:\ Program Files(x86)\ WinSCP \ WinSCP.exe”“/ script = C:\ Users\abcd\Desktop\efgh\remotelocal.txt”在“C” :\ Users \ abcd \ Desktop \ efgh“,进程退出代码为”1“,而期望值为”0“。

1 个答案:

答案 0 :(得分:2)

get *.* C:\Users\abcd\Desktop\egfh

嗯。我不确定这是否是一个有效的命令。可能需要:

get *.* C:\Users\abcd\Desktop\egfh\

或者:

lcd C:\Users\abcd\Desktop\egfh\
get *.* 

然而,对此进行故障排除的问题在于它是 WinSCP 抛出错误。 SSIS无法记录该错误,但您可以告诉WinSCP创建日志。

在SSIS中,在执行流程任务中,从以下位置更改WinSCP的参数:

/script=C:\Users\abcd\Desktop\efgh\remotelocal.txt

对于这样的事情:

/script=C:\Users\abcd\Desktop\efgh\remotelocal.txt /xmllog="M:\SSIS\Alexandria Patron Export\WinSCPLog.xml"

我选择标准日志上的XML日志,因为标准日志更加冗长,更难以看到发生了什么。如果您想要该日志,请尝试:

/script=C:\Users\abcd\Desktop\efgh\remotelocal.txt /log="M:\SSIS\Alexandria Patron Export\WinSCPLog.log"

现在尝试运行您的软件包,看看WinSCP记录了哪些错误。

相关问题