I wrote some scripts which ftp files from a server to the local machine. The scripts have different behaviour under difference mode.
If I run it interactively, the ftp is fine:
ftp> mget *abc*.reviewed
200 Type set to A.
200 PORT command successful.
150 Opening ASCII mode data connection for xxx_abc_yyyymmdd.reviewed(506 bytes).
226 Transfer complete.
ftp: 506 bytes received in 0.00Seconds 506000.00Kbytes/sec.
If I scheduled it in the windows task scheduler, it only show the following:
ftp> mget *abc*.reviewed
200 Type set to A.
I suspect there is a error following but there are not log. What could I done wrong?
Sample of my code:
call :Logic > E:\ftp_%yyyymmdd%.log 2>&1
exit /b 0
:Logic
ftp -i -s:C:\App\XXX\bin\ftp_script.txt some.host.net
I make the output into a log file but I don't know if the error stream has been successfully configure. I could be losing some error log.
content of ftp_script.txt:
username
password
lcd E:\YYY
cd /XXX/YYY/ZZZ
mget *abc*.reviewed
mget *bcd*.reviewed
mget *cde*.reviewed
bye
Further case study:
The script was scheduled to be run at everyday 8PM. I checked the server today and found out the target server contains the files I want, with the last modifed attribute of 6:54PM. So the file should be there at 8PM and they were not ftp in yesterday's schedule.
I assume the last modified attribute equal to the time it was copied ( from other directory ) or rename ( the file should be renamed from .csv to .reviewed ).
I scheduled a one off task in 12:40pm to run the script and the files were successfully ftp from the target server to the local server.
It is really confusing.