说明:
set "l0=C:\jjye" 源路径
set "l1=w:\jjye" 目标路径
call,30 这里的30指30天前- @echo off&setlocal enabledelayedexpansion
- set "l0=C:\jjye"
- set "l1=w:\jjye"
- call:D,30
- for /f "delims=" %%a in ('dir /a:-d/b "%l0%"') do (
- set t=%%~ta
- set t=!t:-=!
- if not "!t:~0,8!" lss "%D%" (
- if not exist "%l1%\!t:~,06!\" md "%l1%\!t:~,06!"
- move "%%a" %l1%\!t:~,06!
- ))
- exit
- :D
- for /f "tokens=1-3 delims=-:/ " %%a in ("%date%") do set Y=%%a&set M=%%b&set D=%%c
- if "%M:~0,1%"=="0" set M=%M:~1%
- if "%D:~0,1%"=="0" set D=%D:~1%
- set/a D-=%1
- if %D% gtr 0 goto:Y
- :M
- set/a M-=1
- if !M!==0 set/a Y-=1,M=12
- set/a "T=^!(M-2)","R=(^!(Y%%4)&^!^!(Y%%100))|^!(Y%%400)","C=^!(M-4)|^!(M-6)|^!(M-9)|^!(M-11)","D=T*(28+R)+C*30+(^!T&^!C)*31+D"
- if %D% leq 0 goto:M
- :Y
- set M=0%M%&set D=0%D%&set D=%Y%!M:~-2!!D:~-2!
复制代码
|