本帖最后由 apang 于 2013-9-24 18:10 编辑
放到计划任务里,每3分钟执行一次。没考虑子目录情况。
小时前面少一个0,改一下- @echo off
- set "SrcDir=E:\test"
- set "DstDir=E:\test2"
-
- echo,D = DateAdd("n",-30,Now)>"%tmp%\$.vbs"
- echo,WScript.Echo Year(D)*10000+Month(D)*100+Day(D)^&_>>"%tmp%\$.vbs"
- echo,Right("0"^&(Hour(D)*10000+Minute(D)*100+Second(D)),6)>>"%tmp%\$.vbs"
-
- for /f "delims=" %%a in ('cscript /NoLogo "%tmp%\$.vbs"') do set "t=%%a"
- for %%a in ("%SrcDir%\") do set "Drv=%%~da" & set "Pth=%%~pa"
- set w=wmic datafile where "Drive='%Drv%' and Path='%Pth:\=\\%'"
-
- for /f "tokens=1*" %%a in ('%w% get CreationDate^,Name^|find ":"') do (
- if "%%~na" lss "%t%" (
- for /f "tokens=*" %%c in ("%%b") do move "%%~fc" "%DstDir%\"
- )
- )
- del "%tmp%\$.vbs"
复制代码
|