53 lines
1.2 KiB
Batchfile
53 lines
1.2 KiB
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
echo ========================================
|
|
echo Nexus Cache Cleaner
|
|
echo ========================================
|
|
echo.
|
|
|
|
echo Starting cache cleanup...
|
|
echo.
|
|
|
|
REM 计数器初始化
|
|
set "pycache_count=0"
|
|
set "temp_count=0"
|
|
|
|
REM 清理 Python __pycache__ 目录
|
|
echo [1/2] Cleaning Python cache files...
|
|
for /f "delims=" %%d in ('dir /s /b /ad __pycache__ 2^>nul') do (
|
|
echo Deleting: %%d
|
|
rd /s /q "%%d" 2>nul
|
|
if !errorlevel! equ 0 (
|
|
set /a pycache_count+=1
|
|
)
|
|
)
|
|
|
|
REM 清理临时文件
|
|
echo [2/2] Cleaning temporary files...
|
|
for %%ext in (*.tmp *.temp *.pyo) do (
|
|
for /f "delims=" %%f in ('dir /s /b "%%ext" 2^>nul') do (
|
|
echo Deleting: %%f
|
|
del /f /q "%%f" 2>nul
|
|
if !errorlevel! equ 0 (
|
|
set /a temp_count+=1
|
|
)
|
|
)
|
|
)
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo Cleanup Summary:
|
|
echo Python cache directories: !pycache_count!
|
|
echo Temporary files: !temp_count!
|
|
echo ========================================
|
|
|
|
if !pycache_count! gtr 0 (
|
|
echo Cache cleanup completed successfully!
|
|
) else if !temp_count! gtr 0 (
|
|
echo Temporary files cleanup completed!
|
|
) else (
|
|
echo No cache files found to clean.
|
|
)
|
|
|
|
echo.
|
|
pause |