本帖最后由 pcl_test 于 2015-3-18 06:20 编辑
回复 26# buyixuelang - @echo off
- set "FolderQQ=D:\Program Files\Tencent\QQ2015\Users"
- cd /d "%FolderQQ%"
- for /f "delims=" %%i in ('dir /b /ad ^| findstr "^[0-9]*$"') do (
- set n=0 & set s=0 & set m=0
- if exist "%FolderQQ%\%%i\Image\" pushd "%FolderQQ%\%%i\Image\"
- for /f "delims=" %%a in ('dir /a-d /b 2^>nul') do (
- del /f /q "%%a" && set /a n+=1 && set /a s+=%%~za
- )
- setlocal enabledelayedexpansion
- for /f "delims=" %%b in ('dir /ad /b 2^>nul') do (
- set t=0
- for /f "delims=" %%c in ('dir /a-d /s /b "%%b\" 2^>nul') do set /a t+=1
- if !t! == 0 (rd "%%b" /s /q && set /a m+=1)
- )
- echo %%i
- if !s! lss 1024 set "z=字节"
- if !s! geq 1024 if !s! lss 1048576 (set /a s=!s!/1024 & set "z= KB")
- if !s! geq 1048576 (set /a s=!s!/1048576 & set "z= MB")
- echo 清理了!n!个文件,共计!s!!z!
- echo 清理了!m!个空文件夹
- echo.
- endlocal
- popd
- )
- pause
复制代码
|