联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off for /f "delims=" %%a in ('dir /b /a-d /od D:\test\*.bak') do ( for /f "tokens=2* delims=_" %%i in ('echo.%%a') do call :slz "%%i" "%%~nj" "%%a" ) echo 最新日期%most% 对应文件名%file% echo 次新日期%most1% 对应文件名%file1% echo FTP没测试环境自己搞定 pause :slz set "fdate=%~2" if not defined fdate goto:eof set "filedate=%fdate:~2,-2%" if not defined most set "most=0" if %filedate% gtr %most% ( set "most=%filedate%" set "most1=%most%" set "file=%~3" set "file1=%file%" ) goto:eof
@echo off for /f "delims=" %%a in ('dir /b /a-d /od D:\test\*.bak') do ( for /f "tokens=2* delims=_" %%i in ('echo.%%a') do call :slz "%%i" "%%~nj" "%%a" ) echo 最新日期%most% 对应文件名%file% echo 次新日期%most1% 对应文件名%file1% >test.scr echo user admin >>test.scr echo pass >>test.scr echo put "%file%" >>test.scr echo put "%file1%" >>test.scr echo quit ftp -n -s:test.scr 192.168.0.1 pause :slz set "fdate=%~2" if not defined fdate goto:eof set "filedate=%fdate:~2,-2%" if not defined most set "most=0" if %filedate% gtr %most% ( set "most=%filedate%" set "most1=%most%" set "file=%~3" set "file1=%file%" ) goto:eof