日期:2014-05-16 浏览次数:21091 次
@echo off
setlocal enabledelayedexpansion
set src_dir=c:\a
set dst_dir=c:\b
set last_full_time=0
set last_diff_time=0
for /r "%src_dir%" %%a in (*) do (
for /f "tokens=2,3 delims=_" %%b in ("%%~na") do (
if "%%b"=="diff" (
if %%c gtr !last_diff_time! (
set last_diff_time=%%c
set last_diff_name=%%a
)
) else (
if %%c gtr !last_full_time! (
set last_full_time=%%c
set last_full_name=%%a
)
)
)
)
if %last_full_time% equ 0 goto :eof
if %last_diff_time% equ 0 goto :eof
if %last_full_time% lss %last_diff_time% copy /b "%last_diff_name%" "%dst_dir%"
copy /b "%last_full_name%" "%dst_dir%"