::set num=%date:~0,4%%date:~5,2%
set year=%date:~0,4%
set mon=%date:~5,2%
if %mon% EQU 1 set /a aY=%year%-1 && set /a aM=12
set /a mon-=1
for /f "delims=" %%a in ('dir /ad /b') do (
if not defined aM (if %%a LSS %year%%mon% rd /s /q %%a)
if !aY! LSS %year% if %%a LSS !aY!!aM! rd /s /q %%a)