@echo off
setlocal EnableDelayedExpansion
rem Get Julian Day number of today's date
for /F "tokens=1-3 delims=/" %%a in ("%date%") do (
set /A m=1%%a %% 100, d=1%%b %% 100, y=%%c
)
set /A A=(m-14)/12, todayJDN = (1461*(y+4800+A))/4 + (367*(m-2-12*A))/12 - (3*((y+4900+A)/100))/4 + d - 32075
rem Process all folders
for /D %%a in (*) do (
rem Get Julian Day Number of this folder
set folder=%%a
set /A m=1!folder:~0,2! %% 100, d=1!folder:~2,2! %% 100, y=!folder:~4!
set /A "A=(m-14)/12, folderJDN = (1461*(y+4800+A))/4 + (367*(m-2-12*A))/12 - (3*((y+4900+A)/100))/4 + d - 32075"
rem Move folder if it is older than 30 days
set /A daysOlder=todayJDN - folderJDN
if !daysOlder! gtr 30 move %%a D:\Backup\Processed\
)
此处描述了儒略日数字:http ://www.hermetic.ch/cal_stud/jdn.htm