I'm running a batch file in Win2003 to transfer a file via FTP.
The batch file pipes the FTP session results into a FIND to see if there's a 226 success message, and this works well. Unfortunately, from a scheduler I'm hitting the errorlevel condition, even though the file transfers successfully and the 226 message is returned.
FTP -s:go.ftp 2>NUL | Find "226 Transfer OK" > NUL
If ErrorLevel 1 Echo ERROR - FTP transfer failed. >> err.log
The user account is an admin account, so it's not a rights issue. Any ideas?
UPDATE:
The 226 message is not being captured via redirect, thus failing the FIND. In my testing, I redirected the FTP output to a separate file when run from the scheduler. Although the FTP commands are running successfully, none of the server responses are appearing.
Here is my FTP script:
open ftpsite
username
password
dir
quit
Here is the output ( FTP -s:go.ftp >ftp.log 2>ftp.err ).
User (ftpsite:(none)): open ftpsite
04-01-12 02:35PM <DIR> DIR1
04-01-12 02:35PM <DIR> DIR2
04-01-12 02:35PM <DIR> DIR3
04-01-12 02:35PM <DIR> DIR4
dir
quit
Additionally, nothing appears in the error stream ( 2>ftp.err ). At least I know now why my FIND's errorlevel isn't being triggered, but why aren't the FTP server responses being captured? I'm not using the -v switch or toggling verbose.
-dto enable debugging? You might need to parseftp.login some other way to determine whether it was successful or not. - tomlogic