[Solved] How to connect FTP and download files via Windows cmd script - S7an Insights

Breaking

S7an Insights

生活 × 技術 × 分享 讓複雜的問題,有條理地解決。

2020年6月23日 星期二

[Solved] How to connect FTP and download files via Windows cmd script

I create these two script and set up a scheduled task to run FtpScript.bat.
And record running log, you might need to check the date time format in "Date and Time".



FtpScript.bat
cd /d E:\OTTTFiles\TempFiles\Input\
set nYear=%Date:~0,4%
set nMonth=%Date:~5,2%
set nDay=%Date:~8,2%
set GetFTPlog=D:\OTLogs\FtpScript_%nYear%_%nMonth%_%nDay%.log
ftp -s:D:\ScheduleTask\FTPcommand.txt >> %GetFTPlog%



FTPcommand.txt
open 192.168.xx.xx
OTTT
747474YT
binary
prompt
cd \OTTTmsg
mget ProductMessage*otttmg
mdelete ProductMessage*otttmg
disconnect
bye


[img.1] Windows timestamp

沒有留言:

張貼留言

問題沒有大小或好壞