Question Locked

Cleanup of *.tmp files on shared network storage Windows SBS 2003

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Is there a tool that finds and removes old *.tmp files on a shared network store?

4 replies

by rkuhn040172

Change a few variable and away you go. You could even schedule it through the Task Scheduler.

REM @echo off
REM - This script searches through each home directory for temporary internet files and deletes them.
REM - The script also empties the temp folder
REM - THese lines set the starting directory for the script

set HDRIVE=c:
set HPATH=Documents and Settings

%HDRIVE%
cd \%HPATH%

REM - This line sets up the loop for the script
for /d %%i in (*) do call :ifthen %%i

goto end

REM - These lines check for the presence of the temporary internet file directories and call subroutines to deal with them.
:ifthen

if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Temporary Internet Files\Content.IE5" call :ContentDelete1 %1
if exist "%HDRIVE%\%HPATH%\%1\windows\Temporary Internet Files\Content.IE5" call :ContentDelete2 %1
if exist "%HDRIVE%\%HPATH%\%1\Local Settings\temp" call :TempDelete %1
if exist "%HDRIVE%\%HPATH%\%1\cookies" call cookiesdelete %1
goto :EOF

REM - This subroutine removes all folders located in the user's "Profile\Local Settings\Temporary Internet Files\Content.IE5"
REM - directory (in their home directory). It then returns back to the line that it was called from.
:ContentDelete1

cd "%HDRIVE%\%HPATH%\%1\Local Settings\Temporary Internet Files\Content.IE5"
if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Temporary Internet Files\Content.IE5" for /d %%n in (*) do rd /s /q "%%n"
if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Temporary Internet Files\Content.IE5" del /q "%HDRIVE%\%HPATH%\%1\Local Settings\Temporary Internet Files\Content.IE5\*"
goto :EOF

REM - This subroutine removes all folders located in the user's "windows\Temporary Internet Files\Content.IE5" directory located
REM - in their home directory. It then removes all subfolders from this directory.
:ContentDelete2
cd "%HDRIVE%\%HPATH%\%1\windows\Temporary Internet Files\Content.IE5"
if exist "%HDRIVE%\%HPATH%\%1\windows\Temporary Internet Files\Content.IE5" for /d %%n in (*) do rd /s /q "%%n"
if exist "%HDRIVE%\%HPATH%\%1\windows\Temporary Internet Files\Content.IE5" del /q "%HDRIVE%\%HPATH%\%1\windows\Temporary Internet Files\Content.IE5\*"

goto :EOF

REM - This subroutine removes all folders located in the user's "windows\Temporary Internet Files\Content.IE5" directory located
REM - in their home directory. It then removes all subfolders from this directory.
:TempDelete
cd "%HDRIVE%\%HPATH%\%1\Local Settings\Temp"
if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Temp" for /d %%n in (*) do rd /s /q "%%n"
if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Temp" del /q "%HDRIVE%\%HPATH%\%1\Local Settings\Temp\*"

REM - This subroutine removes all folders located in the user's "cookies" directory located
REM - in their home directory. It then removes all subfolders from this directory.
:cookiesdelete
cd "%HDRIVE%\%HPATH%\%1\cookies"
if exist "%HDRIVE%\%HPATH%\%1\cookies" for /d %%n in (*) do rd /s /q "%%n"
if exist "%HDRIVE%\%HPATH%\%1\cookies" del /q "%HDRIVE%\%HPATH%\%1\cookies\*"

goto :EOF

:end

This discussion is closed to new replies.