昨日の続き。BluePrismからFTPしたい。
今回はコマンドラインでFTPWinSCPからコマンドライン実行でFTPを実行してみた。
WinSCPをコマンドライン実行してでFTPをするには、
以下のようにWinscp.exeにオプションを渡して実行する。
Winscp.exe /console /script=C:\Study\FtpByWinscp\FtpScript.txt /log=C:\Study\FtpByWinscp\ftp.log /passive
/console コンソール実行
/script FTPのコマンドを記載したスクリプトファイル名
/log ログ出力ファイル指定
/passive passiveモード指定
/timeout タイムアウト(秒)
/scriptで指定したファイルにFTPのコマンドを記載
# 問い合わせを無効
option batch on# 確認無効
option confirm offopen anonymous@ftp.jaist.ac.jp
cd /pub/Linux/CentOS
option transfer binary
get timestamp.txt C:\Study\FtpByWinscp\
# 切断
closeexit
BluePrismのプロセスからWinSCPを実行
Uitlity - Environment:Start Process Read Stderr and StdoutでWinSCPとパラメータを指定。
無事ファイルをゲットできた。
FTPでエラーが発生した場合、/logに指定したログに詳しく出力されるけど、Stderr/Stdoutにはなにも出力されないので、ちょっと微妙?