I want to automate the connection and retrival of files using sftpg3.exe. I know how to use the -B batch file option to provide the input to the session. But How do I write the output to a text log file so that I can review it later as needed. Here is an example of by scheduled batch file which kicks off sftpg3 and the -B batch file: kick.bat set mydate=%date% Set mydate=%mydate:~4,14% set mydate=%mydate:/=% set mytime=%time% set mytime=%mytime:~0,8% set mytime=%mytime::=% sftpg3.exe -D 99 - v -B get_file.txt myid@server > e:\ScannedImages\log\%mydate%%mytime%.log get_file.txt verbose binary get *.zip quit |
The following seems to work: kick.bat set mydate=%date% Set mydate=%mydate:~4,14% set mydate=%mydate:/=% Set mytime=%time% set mytime=%mytime:~0,8% set mytime=%mytime::=% sftpg3.exe -D 99 -B get_file.txt myid@server 1> e:\log\WIN_%mydate%%mytime%.log 2> e:\log\SFTPG3_%mydate%%mytime%.log get_file.txt verbose binary get *.zip quit |