下面是小弟的代码,还请各位指教,我试着用这个批处理下载其他的文件都是正常,但就是下载想要的文件时就会出现下载下来的文件大小为0的情况,我再想是不是因为文件属性的问题,因为我用total command 下载这些文件时发现跟我用批处理下载下来的文件名不一样,用批处理下载下来的文件总是会比原文件名少几个字符,但是指令执行完后确实提示下载了很多的流量!!!!!- @echo off
- SETLOCAL ENABLEDELAYEDEXPANSION
- set Log_Path=D:\
- set Remote_IP=#########
- set path=%path%;d:\program files\winrar\
-
- ::取昨天的日期
- set yy=%Date:~0,4%
- set mm=%Date:~5,2%
- set dd=%Date:~8,2%
- set /a od=!dd!-1
- if !od!==0 call :dd0
- if !mm!==0 call :mm0
- set /a dd=od
- set "dd=0!dd!"
- set "dd=!dd:~-2!"
- set "mm=0!mm!"
- set "mm=!mm:~-2!"
- set yymmdd=!yy!!mm!!dd!
-
- ::从文件STSFilelist.txt中判断并创建所需要的文件列表到文件WantedFileList.txt
- echo eric>>%Log_Path%WantedFileList.txt
- echo solaris7>>%Log_Path%WantedFileList.txt
- echo type ASCII>>%Log_Path%WantedFileList.txt
- echo cd /var/opt/ericsson/sgw/outputfiles/apgfiles/sts/>>%Log_Path%WantedFileList.txt
- for /f %%j in (%Log_Path%STSFilelist.txt) do (
- set filename=%%j
- set FileTime=%%j
- set FileTime=!FileTime:~10,4!
- if "!filename:~-12,5!"=="CZBSC" (
- if "!filename:~1,8!"=="%yymmdd%" (
- if "!filename:~-5,4!"=="1000" (
- findstr "!FileTime!" D:\TimeFilter.txt>nul
- if !ERRORLEVEL!==0 echo %%j>>mget %Log_Path%WantedFileList.txt
- ) else (
- if "!filename:~-5,4!"=="1003" (
- findstr "!FileTime!"
-
- D:\TimeFilter.txt>nul
- if !ERRORLEVEL!==0 echo
-
- mget %%j>>%Log_Path%WantedFileList.txt
- )
- )
- )
- )
- )
- echo close>>%Log_Path%WantedFileList.txt
- echo quit>>%Log_Path%WantedFileList.txt
-
- ::下载所需要的文件并压缩
- cd ftp\
- ftp -i -s:%Log_Path%WantedFileList.txt %Remote_IP%
-
- for "useback" %%j in (`dir /a-d /b`) do (
- winrar a -df -m5 STS%yymmdd% %%j
- )
- move STS%yymmdd%.rar Log_Path%
-
-
- :dd0
- set /a mm=!mm!-1
- for %%a in (1 3 5 7 8 10 12)do set %%add=31
- set /a pddd=!yyyy!*10/4
- set pd2d=!pddd:~-1,1!
- set 2dd=28
- if !pd2d!==0 set 2dd=29
- for %%b in (4 6 9 11)do set %%bdd=30
- set od=!%mm%dd!
- goto :eof
- :mm0
- set /a yy=!yy!-1
- set mm=12 && set od=31
- goto :eof
复制代码
|