[BAT] 通过批处理删除7天前的报告,并删除当前目录下的空文件夹

set reportPath=D:AutomationReport

cd /d %reportPath%

forfiles /p %reportPath% /s /m *.xml /d -7 /c "cmd /c del /f @path">nul 2>nul

for /f "tokens=*" %%a in ('dir /b /ad /s^|sort /r') do rd "%%a" 2>nul

  

原文地址:https://www.cnblogs.com/MasterMonkInTemple/p/4649009.html