diff --git a/clean_logs.bat b/clean_logs.bat index c0c327c..dbf2aae 100644 --- a/clean_logs.bat +++ b/clean_logs.bat @@ -3,7 +3,7 @@ chcp 65001 >nul setlocal enabledelayedexpansion REM 设置目标目录 -set TARGET_DIR=e:\path\to\your\logs +set TARGET_DIR=E:\pythontest\CLEAN_EVERYTHING\新建文件夹 REM 设置日志文件路径 set LOG_FILE=%~dp0clean_logs_history.log @@ -24,13 +24,17 @@ if not exist "%TARGET_DIR%" ( ) REM 初始化变量 -set /a TOTAL_SIZE=0 -set /a FILE_COUNT=0 +set FILE_COUNT=0 +set TOTAL_SIZE=0 +set TOTAL_SIZE_MB=0 REM 清理.log文件 for /r "%TARGET_DIR%" %%f in (*.log) do ( set /a FILE_COUNT+=1 - for %%s in ("%%f") do set /a TOTAL_SIZE+=%%~zs + for %%s in ("%%f") do ( + set FILE_SIZE=%%~zs + set /a TOTAL_SIZE_MB+=FILE_SIZE/1048576 + ) echo 删除文件:%%f >> "%LOG_FILE%" del /f /q "%%f" )