命令如下:D:IT_Softwaremavenmaven-repository-BDA168就是maven仓库地址
@echo off set objLength=4 set fliePath=D:IT_Softwaremavenmaven-repository-BDA168 set obj[0].name=repositories set obj[1].name=sha1 set obj[2].name=pom set obj[3].name=lastUpdated set objIndex=0 :loopStart if %objIndex% equ %objLength% goto end set objCurrent.name=0 for /f "usebackq delims==. tokens=1-3" %%i in (`set obj[%objIndex%]`) do ( set objCurrent.%%j=%%k ) echo 正在删除.%objCurrent.name% for /r %fliePath% %%a in (*.%objCurrent.name%) do ( del "%%a" /f /q echo 文件"%%a"成功删除! ) set /a objIndex=%objIndex% + 1 goto loopStart :end echo 正在删除空文件夹 for /f "delims=" %%b in ('dir /ad /b /s %fliePath%^|sort /r') do ( rd "%%b">nul 2>nul && echo 空目录"%%b"成功删除! ) pause
运行截图