CODE: [Copy to clipboard]
@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
筛选删除FTP上我无能为力