| E:\Documents and Settings\eetc>F:\test.bat |
| |
| E:\Documents and Settings\eetc>rem 指定FTP用户名 |
| |
| E:\Documents and Settings\eetc>set ftpUser=asx |
| |
| E:\Documents and Settings\eetc>rem 指定FTP密码 |
| |
| E:\Documents and Settings\eetc>set ftpPass=asx-asx |
| |
| E:\Documents and Settings\eetc>rem 指定FTP服务器地址 |
| |
| E:\Documents and Settings\eetc>set ftpIP=172.19.103.7 |
| |
| E:\Documents and Settings\eetc>rem 指定待下载的文件位于FTP服务器的什么位置 |
| |
| E:\Documents and Settings\eetc>set ftpFolder=/export/home/PROD/ntcdata |
| |
| E:\Documents and Settings\eetc>rem 指定从FTP下载下来的文件存放到什么地方 |
| |
| E:\Documents and Settings\eetc>set DownFolder=E:\Temp |
| |
| E:\Documents and Settings\eetc>rem 指定下载几天前的文件 |
| |
| E:\Documents and Settings\eetc>set DaysAgo=1 |
| |
| E:\Documents and Settings\eetc>set ftpDir=E:\DOCUME~1\eetc\LOCALS~1\Temp\TempDir |
| .txt |
| |
| E:\Documents and Settings\eetc>set ftpDown=E:\DOCUME~1\eetc\LOCALS~1\Temp\TempDo |
| wn.txt |
| |
| E:\Documents and Settings\eetc>rem 假设本机日期格式为yyyy-mm-dd |
| |
| E:\Documents and Settings\eetc>set FileY=2009 |
| |
| E:\Documents and Settings\eetc>call :DateToDays 2009 04 09 PassDays |
| |
| E:\Documents and Settings\eetc>setlocal ENABLEEXTENSIONS |
| |
| E:\Documents and Settings\eetc>set yy=2009 & set mm=04 & set dd=09 |
| |
| E:\Documents and Settings\eetc>if 12009 LSS 200 if 12009 LSS 170 (set yy=202009 |
| ) else (set yy=192009 ) |
| |
| E:\Documents and Settings\eetc>set /a dd=10009%100,mm=10004%100 |
| |
| E:\Documents and Settings\eetc>set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=15 |
| 3*m+2 |
| |
| E:\Documents and Settings\eetc>set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633 |
| |
| E:\Documents and Settings\eetc>endlocal & set PassDays=14343 & goto :EOF |
| |
| E:\Documents and Settings\eetc>set /a PassDays-=DaysAgo |
| |
| E:\Documents and Settings\eetc>call :DaysToDate 14342 DstYear DstMonth DstDay |
| |
| E:\Documents and Settings\eetc>setlocal ENABLEEXTENSIONS |
| |
| E:\Documents and Settings\eetc>set /a a=14342+2472632,b=4*a+3,b/=146097,c=-b*146 |
| 097,c/=4,c+=a |
| |
| E:\Documents and Settings\eetc>set /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+ |
| 2,m/=153,dd=153*m+2,dd/=5 |
| |
| E:\Documents and Settings\eetc>set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*10 |
| 0+d-4800+m/10 |
| |
| E:\Documents and Settings\eetc>(if 4 LSS 10 set mm=04 ) & (if 8 LSS 10 set dd=0 |
| 8 ) |
| |
| E:\Documents and Settings\eetc>endlocal & set DstYear=2009 & set DstMonth=04 & |
| set DstDay=08 & goto :EOF |
| |
| E:\Documents and Settings\eetc>echo.asx1>"E:\DOCUME~1\eetc\LOCALS~1\Temp\TempDir |
| .txt" |
| |
| E:\Documents and Settings\eetc>echo.asx-asx1>>"E:\DOCUME~1\eetc\LOCALS~1\Temp\Te |
| mpDir.txt" |
| |
| E:\Documents and Settings\eetc>echo bin 1>>"E:\DOCUME~1\eetc\LOCALS~1\Temp\TempD |
| ir.txt" |
| |
| E:\Documents and Settings\eetc>echo cd "/export/home/PROD/ntcdata" 1>>"E:\DOCUME |
| ~1\eetc\LOCALS~1\Temp\TempDir.txt" |
| |
| E:\Documents and Settings\eetc>echo dir * "E:\DOCUME~1\eetc\LOCALS~1\Temp\FileLi |
| st.txt" 1>>"E:\DOCUME~1\eetc\LOCALS~1\Temp\TempDir.txt" |
| |
| E:\Documents and Settings\eetc>echo bye 1>>"E:\DOCUME~1\eetc\LOCALS~1\Temp\TempD |
| ir.txt" |
| |
| E:\Documents and Settings\eetc>start ftp -v -i -s:"E:\DOCUME~1\eetc\LOCALS~1\Tem |
| p\TempDir.txt" 172.19.103.7 |
| |
| E:\Documents and Settings\eetc>rem 根据实际情况自行调节延迟时间 |
| |
| E:\Documents and Settings\eetc>ping -n 10 127.1 1>nul |
| |
| E:\Documents and Settings\eetc>findstr /i ":*\.SWM$" "E:\DOCUME~1\eetc\LOCALS~1\ |
| Temp\FileList.txt" 1>"E:\DOCUME~1\eetc\LOCALS~1\Temp\FileDate.txt" |
| |
| E:\Documents and Settings\eetc>findstr /i ":*\.TWM$" "E:\DOCUME~1\eetc\LOCALS~1\ |
| Temp\FileList.txt" 1>>"E:\DOCUME~1\eetc\LOCALS~1\Temp\FileDate.txt" |
| |
| E:\Documents and Settings\eetc>findstr /i ":*\.XWM$" "E:\DOCUME~1\eetc\LOCALS~1\ |
| Temp\FileList.txt" 1>>"E:\DOCUME~1\eetc\LOCALS~1\Temp\FileDate.txt" |
| |
| E:\Documents and Settings\eetc>echo.asx1>"E:\DOCUME~1\eetc\LOCALS~1\Temp\TempDow |
| n.txt" |
| |
| E:\Documents and Settings\eetc>echo.asx-asx1>>"E:\DOCUME~1\eetc\LOCALS~1\Temp\Te |
| mpDown.txt" |
| |
| E:\Documents and Settings\eetc>echo bin 1>>"E:\DOCUME~1\eetc\LOCALS~1\Temp\TempD |
| own.txt" |
| |
| E:\Documents and Settings\eetc>echo cd "/export/home/PROD/ntcdata" 1>>"E:\DOCUME |
| ~1\eetc\LOCALS~1\Temp\TempDown.txt" |
| |
| E:\Documents and Settings\eetc>(for /F "usebackq tokens=1-9 delims= " %a in ("E: |
| \DOCUME~1\eetc\LOCALS~1\Temp\FileDate.txt") do ( |
| setlocal enabledelayedexpansion |
| if "%f" EQU "Jan" (set FileM=01 ) else if "%f" EQU "Feb" (set FileM=02 ) else |
| if "%f" EQU "Mar" (set FileM=03 ) else if "%f" EQU "Apr" (set FileM=04 ) else |
| if "%f" EQU "May" (set FileM=05 ) else if "%f" EQU "Jun" (set FileM=06 ) else |
| if "%f" EQU "Jul" (set FileM=07 ) else if "%f" EQU "Aug" (set FileM=08 ) else |
| if "%f" EQU "Sep" (set FileM=09 ) else if "%f" EQU "Oct" (set FileM=10 ) else |
| if "%f" EQU "Nov" (set FileM=11 ) else if "%f" EQU "Dec" (set FileM=12 ) |
| set FileD=10%g |
| set FileD=!FileD:~-2! |
| if "!FileM!" EQU "04" (if "!FileD!" EQU "08" (echo get "%i" ) ) |
| endlocal |
| ) ) 1>>"E:\DOCUME~1\eetc\LOCALS~1\Temp\TempDown.txt" |
| |
| E:\Documents and Settings\eetc>echo bye 1>>"E:\DOCUME~1\eetc\LOCALS~1\Temp\TempD |
| own.txt" |
| |
| E:\Documents and Settings\eetc>start ftp -v -i -s:"E:\DOCUME~1\eetc\LOCALS~1\Tem |
| p\TempDown.txt" 172.19.103.7 |
| |
| E:\Documents and Settings\eetc>goto :eofCOPY |