日期:2014-05-17 浏览次数:20853 次
@echo off
set ftpUser=datastore
set ftpPass=datastore
set ftpIP=128.1.100.79
set ftpFolder=
set DownFolder=d:\
rem 假设系统日期格式为yyyy-mm-dd
set Year=%date:~0,4%
set Month=%date:~5,2%
set Day=%date:~8,2%
echo "第一步:先获取通知文件"
set ftpFile1=%temp%\TempAcc.txt
>"%ftpFile1%" (
echo.%ftpUser%
echo.%ftpPass%
echo cd "%ftpFolder%%Year%%Month%%Day%"
echo bin
echo get "dingting%Year%%Month%%Day%.OK"
echo prompt
echo bye
)
cd /d "%DownFolder%"
ftp -v -i -s:"%ftpFile1%" %ftpIP%
set ftpFile=%temp%\TempAcc1.txt
>"%ftpFile%" (
echo.%ftpUser%
echo.%ftpPass%
echo cd "%ftpFolder%%Year%%Month%%Day%"
echo bin
echo get "BOP2.txt"
echo prompt
echo bye
)
echo "日终日期:%Year%%Month%%Day%"
echo "第二步:判断通知文件是否存在,存在的情况下再去取数据文件"
if exist d:\dingting20130130.OK (
cd /d "%DownFolder%"
ftp -v -i -s:"%ftpFile%" %ftpIP%
) else echo 通知文件不存在!
pause
goto :eof