@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in ('dir /a:d /b') do set i=%%i&if "!i:~0,5!"=="data " (
echo !i:~5!|findstr /i "^--$">nul
if !ERRORLEVEL!==0 if "!i:~5,4!!i:~10,2!!i:~13,2!" lss "20100201" (
attrib -r -s -h "%%i" /s
del "%%i" /a /s /q /f
rd "%%i" /s /q
))
说明:
如果目录中不存在其他命名方式的目录,则if "!i:~0,5!"=="data " (
echo !i:~5!|findstr /i "^--$">nul
if !ERRORLEVEL!==0 部分可以省略
如果目录及其子目录不存在系统或隐藏属性的问题,则attrib -r -s -h "%%i" /s可以省略