- @echo off
- set "searchdir=."
- set "searchpattern=????-??-?? *.txt"
- set "newfile=.\new.txt"
- set startdate=2019-01-01
- set enddate=2019-01-15
-
- cd . >"%newfile%"
- for /f "delims=" %%A in ('where "%searchdir%:%searchpattern%"') do (
- for /f "tokens=1" %%B in ("%%~nxA") do (
- if %%B geq %startdate% (
- if %%B leq %enddate% (
- REM echo %%A
- copy /y /b "%newfile%"+"%%A"
- echo.>>"%newfile%"
- )
- )
- )
- )
- pause
- exit /b
复制代码
|