Toad World® Forums

[Automation] Using external FTP Program

Has anyone had any luck using an external FTP program as part of their automation scripting?

TDA/TDP has a built-in FTP function, but unfortunately it leaves a lot to be desired at the moment (no support for variables in either file path name or file name, to name one; SFTP w/ key files doesn’t work correctly, to name another).

I have a situation now where I need to upload two reports on a daily basis to two different vendors. At the moment I’m simply generating the reports and emailing them to myself, and then uploading them manually - however, this isn’t a long-term solution as they really need them much earlier in the day than I get into the office.

I have both WS_FTP Pro & WinSCP available to me to use, both of which support various kinds of command line scripting. I’m just not sure how to build a script from Automation to either of those and I’m not finding any information.

I’m not familiar with WinSCP but according to Google you can create batch file with it that Windows understands. If this is the case then you can run this batch with RunActivity and make choices within Automation script based on batch return code.


Right, both WS_FTP and WinSCP allow for the use of batch files.

My question is more how to pass the filename - since it uses variables in both the path name as well as the file name - to the batch script so that it knows where to find the file and what the file name is.

I figured it out. Thanks.

For anyone that is interested I have attached an example of a batch file that when called from Toad automation Run Program activity will transfer a file to an FTP site using WinSCP. On the Program line put in the path and .bat file name.
(i.e. J:\02-MEDECON_FINANCE\30-Extracts\Jiva\WinSCP_FTP.bat)
On ;the Arguments line put in your variables separated by a space. If you have a space in your variable enclose it in quotes.
(i.e. #Path# “File Name with spaces #dateVariable#.xls”)
The above would pass 2 variables (%1 containing a variable path and %2 containing a file name with a variable date) to the WinSCP_FTP batch file. Open the attached bat file to see how the WinSCP would be executed with the passed variables.
WinSCP_FTP_bat.txt (960 Bytes)