- @echo off
- set "SrcDir=D:\ABC\"
- set "DstDir=D:\BackUP\"
- for %%a in ("%SrcDir%") do set drv=%%~da&set "pth=%%~pa"
- for /f "tokens=2delims==" %%a in ('wmic os get localdatetime /value') do (
- set d=%%a
- )
-
- set wmic=wmic datafile where "drive='%drv%' and path='%pth:\=\\%'"
- for /f "tokens=1*" %%a in ('%wmic% get creationdate^,name^|findstr "^%d:~,8%"') do (
- for /f "tokens=*" %%c in ("%%b") do (
- echo xcopy "%%~fc" "%DstDir%" /y
- )
- )
- pause
复制代码
|