<$BlogRSDUrl$>

Saturday, August 02, 2003

More on Drive Cleanliness... 

I blogged a couple of weeks back on setting up automated nightly defrags on WinXP.

The other day, as drive space was getting a little tight for my comfort, I ran the excellent utility JDiskReport from JGoodies to see just where all my drivespace was allocated and made an alarming discovery.

It seems that when I go through my normal work pattern of "start Jboss/Jetty, then hot-deploy, re-hot-deploy, re-hot-deploy (etc)...", it leaves behind expanded war-file directories in my c:\Documents and Settings\<username>\Local Settings\temp directory (NOTE: Local Settings is a hidden folder - so you have to have your view options set correctly to see it). The directories have the name pattern : Jetty_0_0_0_0_<PortNumber>__<WarName> (where <PortNumber> and <WarName> are your respective jetty listening port and war names).

I just got a new machine about a month and a half back, and in that time I had already accumulated about 1.2 GB worth of temporary files in such a manner (I go throught the, change/build/hot-deploy cycle many times a day).

Anyway - I decided to update my automated nightly defrag task to cleanup this stuff too. Here's the updated version - USE WITH CAUTION - the options I'm passing to DEL and RMDIR are equivalent to "do this recursively and don't prompt me whether I really want to delete all this stuff". The %TEMP% environment variable should expand to C:\Documents and Settings\<username>\Local Settings\temp directory by default. You might want to test this manually from the command prompt a few times just to make sure you've typed it in correctly :

::--- recursively remove all files in the temp directory, without
::    prompting, then recursively remove all directories below the
::    temp directory, without prompting

del /F /S /Q "%TEMP%\*" > c:\temp\Defrag_CleanOutTemp.txt 2>&1
rmdir /S /Q "%TEMP%" >> c:\temp\Defrag_CleanOutTemp.txt 2>&1


::--- defrag your local drives

defrag /v /f c: > c:\temp\Defrag_C.txt 2>&1
defrag /v /f d: > c:\temp\Defrag_D.txt 2>&1

This page is powered by Blogger. Isn't yours?