Who’s Got the Most Temp Files then?
Ξ April 21st, 2009 | → 4 Comments | ∇ Coding, Geeky, Microsoft, Programming, Research |
For ages, at every boot, I’ve run a small program called TempClean: all this really does is to clear my Temp folder of stuff that’s left over by programs that don’t clear up after themselves [like a man]. Ok, so it does a little bit more than that [unlike a man] – but that’s its main function.
Anyway, I’d be really interested in knowing how much litter [unwanted files] you have on your Windows machine, and so rather than ask you run the real TempClean [it doesn't have an installer - just save it somewhere and run it!] – which you might be unsure/wary off – here’s a small VBScript ‘script’ so that you can find 0ut for yourself. BTW, this doesn’t remove anything!
Here’s the code:
dim fso
dim fld
dim fle
dim l
set fso = CreateObject("Scripting.FileSystemObject")
set fld = fso.GetSpecialFolder(2)
wscript.echo "Your Temp folder is set to: " & fld.path
sub walk(fld)
wscript.echo vbCrLf & "Looking in: " & fld.path
if fld.files.Count > 0 then
for each fle in fld.files
wscript.echo vbTab & "Found: " & fle.name
l = l + fle.size
next
else
wscript.echo vbTab & "No files found"
end if
for each fld in fld.SubFolders
walk(fld)
next
end sub
walk(fld)
wscript.echo vbCrLf & "The total bytes taken up by your temp files is: " & l
All you need to do to run this is:
- copy ‘n paste it into Notepad [or just download it here];
- save it as, say, tempfiles.vbs;
- run it from a Command Prompt [I'll assume you know how to open a Command Prompt, unlike a woman, to quote Colin Hay "or a woman, if you are one" ... ask a man"].
For example, if I’d saved it to my root folder on C, I’d run it like this, in a DOS/Command prompt:
C:\cscript tempfiles.vbs

BTW, cscript is a Microsoft VBScript interpreter that you’ll almost certainly have on your machine already.
Note again that running this script doesn’t remove anything – it just reports what you’ve got hanging around, and that’s taking up space unnecessarily. And, on that last bit, you might like to output the results of running this to a file – else the output might disappear off the top, never to reappear!
You could do that like this:
C:\cscript tempfiles.vbs > dump.txt
The > redirects the output into a file call dump.txt. So you can then open dump.txt in Notepad and have a look at what you’ve got hanging around – which you might find A) interesting, and B) a lot!!
BTW, if you’d like to remove these temporary files, you can just add either these two lines after the l = l + fle.size, e.g.
l = l + fle.size on error resume next fso.deletefile fle
Or, if you want to do a proper job [like a woman], download and run the real program [link to TempClean above].
Please post up your results, from whichever method, and in summary preferably!



on April 21st, 2009 at 12:41 pm
The total bytes taken up by my temp files is: 68888844
Aaaarrrgh!
on April 21st, 2009 at 1:31 pm
After running TempClean I’ve still got:
“The total bytes taken up by your temp files is: 29212″
Why is that?
on April 21st, 2009 at 1:33 pm
The ‘residual’ is ‘stuff’ that TempClean cannot remove – or rather that you’d like it not to – because some files are in use – when you ran TempClean. I should add that TempClean takes itself into account here!
on April 21st, 2009 at 1:37 pm
AND – thanks for the update! 68,888,844 is rather a saving; given that you’ve now got 29,212 in files that are properly ‘in use’!
Ok, so harddrive space is cheap – but, if you’re as tidy as I am, you want to simply be ‘neat’ right!?