传输第一个文件后,WinSCP脚本停止

时间:2013-11-14 15:24:44

标签: batch-processing winscp

我有一个关于在SSIS中将多个文件从一个目录复制到另一个远程目录的问题。我正在使用WinSCP,下面是我的脚本文件。

option batch on
option confirm off
open username:password@ipaddress -timeout=1000 -hostkey="ssh-rsa 39439:xx:xx:xx:xx:xx"
option transfer binary
put c:\temp\*.xlsx
close
exit

它成功复制了第一个文件,我还有几个要复制的文件。这是复制多个文件的正确方法吗?

2 个答案:

答案 0 :(得分:1)

是的,这是上传多个文件的正确方法。

它不起作用,因为您的服务器不支持保留文件时间戳。

您可以通过添加-nopreservetime switch to the put command使WinSCP不尝试保留时间戳。

put -nopreservetime c:\temp\*.xlsx

有关详细信息,请参阅错误消息Upload of file .. was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option.的文档。

答案 1 :(得分:0)

如果文件被锁定(正在使用),请将“批处理”更改为“继续”,以跳过错误。

option batch continue