Friday, June 20, 2025

Cleaning Windows temp folder

As my SSD gets more and more stuffed, I’m searching for ways to remove the cruft from it. It’s a Windows 10 installation from 2018, which I have a feeling that it needs a fresh formatted install. But since I cannot afford that now, I just keep going.

Cleaning the temp folder manually is a cumbersome chore and also takes a lot of time. The batch script below, in the other hand, deletes all the files instantly:

@echo off

call :DelRecu "%temp%"
call :DelRecu "C:\Users\Rodrigo\AppData\Roaming\Code\logs"
call :DelRecu "C:\Users\Rodrigo\AppData\Roaming\Code\User\workspaceStorage"

pause
goto :eof

:DelRecu
set "FOLDER=%~1"
echo Cleaning: %FOLDER%
del /s /f /q %FOLDER%\*
for /f %%f in ('dir /ad /b %FOLDER%\') do rd /s /q %FOLDER%\%%f
echo --
goto :eof

A double click on the clean.bat file now can be done at any time, in no time.

No comments:

Post a Comment