Posted: 2014-01-13 18:36
I'm just posting this solution because it took me a long time to find it. Hopefully this will make life easier for someone else
We use WINSCP in our SQL Server jobs to upload files to sFTP sites. Normally we export a file and upload it. In this new job we have it doesn't always produce a file in step 1, and then the sFTP part in step 2 would return this error:
The step did not generate any output. Process Exit Code 1. The step failed.
The solution was to include a DOS command before the CALL to WINSCP to first detect if there are any files to upload:
IF EXIST \\servername\dirname\*.csv CALL "E:\Program Files (x86)\WinSCP\winscp.com" /command "option batch abort" "option confirm off" "open sftp://ftpsite.com -hostkey=""keyvalue""" "cd /upload" "put -delete ""\\servername\dirname\*.csv""" "exit"
You can post new topics in this forum
And it's free!