Delete files from TEMP directory= c:\windows\system32\cmd.exe /c del %TEMP%\*.* /q
Nov 22, 2007 11 Replies
B
Bob Wang
A suggestion by Andrew deFaria got me to thinking about temporary files left behind by applications other than Quicken.
I created a Scheduled Task that runs once a day, after Quicken's Scheduled Update:
c:\windows\system32\cmd.exe /c del %TEMP%\*.* /q
HTH someone else
Bob
Didn't find your answer? Ask the community — no account required.
A
Andrew DeFaria
PATH). Couple of points:
You might want to add a /s switch to remove all subdirectories * You may or make not really wish to get rid of everything in %TEMP%. I, for example, use %TEMP% for temporary storage. IOW I may have something in there, for example, Firefox 3.0 Beta 1 Setup.exe, that I may wish to deal with but maybe not for a few days. I don't want it being whacked away. * The above simple approach does nothing for things that cannot be deleted because they are currently in use. My script hides such files by flipping on the hidden bit.
But in general I wish applications would be better about cleaning up their mess in tmp. Quicken's a pretty bad offender...
B
Bob Wang
Andrew:
Good point, forgot that applications also create directories in the TEMP folder. So, the quick and dirty Scheduled Tasks I use are now two:
c:\windows\system32\cmd.exe /c del %TEMP%\*.* /q /s
c:\windows\system32\cmd.exe /c rd %TEMP% /q /s
Thanks for amplifying, Bob
I created a Scheduled Task that runs once a day, after Quicken's Scheduled Update:
c:\windows\system32\cmd.exe /c del %TEMP%\*.* /q
HTH someone else
That's a nice Windows based solution (BTW you don't need C:\windows\system32 - just cmd.exe as that should always be in your PATH). Couple of points:
You might want to add a /s switch to remove all subdirectories You may or make not really wish to get rid of everything in %TEMP%. I, for example, use %TEMP% for temporary storage. IOW I may have something in there, for example, Firefox 3.0 Beta 1 Setup.exe, that I may wish to deal with but maybe not for a few days. I don't want it being whacked away. The above simple approach does nothing for things that cannot be deleted because they are currently in use. My script hides such files by flipping on the hidden bit.
But in general I wish applications would be better about cleaning up their mess in tmp. Quicken's a pretty bad offender...
A
Andrew DeFaria
Ugh! You still don't need C:\Windows\System32 - just cmd.exe, or even shorter, just cmd.
And you don't want that second one. That says to remove the %TEMP% directory altogether. Thereafter I suspect you'll see many failures in software as they probably assume that %TEMP% already exists.
Finally, the first one, del %TEMP%\*.* /q /s is sufficient as it will remove everything in %TEMP% including directories (due to the /s option).
Oh and it still doesn't get rid of files and directories that are open. I'm assuming you don't care about that.
On a slightly off tangent note, I use Process Explorer from Sys Internals (now part of MS) to find who has files/dirs still open. I find a lot of ~DF.tmp and Perflib_Perfdata_ files hanging out in %TEMP%. I have no idea why such files are open and I use Process Explorer to forcibly close them. It never seems to do any harm to the processes themselves. Process Explorer itself often has one of them Preflib files open. If anybody knows what causes such files to come into existence and how one might configure them to not be created then let me know. It seems to be related to performance related monitoring and really I do not wish to monitory performance nor have to clean up these silly files...
B
Bob Wang
YMMV.
1) The del /s command DOES NOT remove ALL directories for me.
2) I need the rd command to remove directories like __SkypeIEToolbar_Cache
3) And, precisely BECAUSE there's Perflib_Perfdata_e4c.dat, ~DFBFF1.tmp and WCESLog.log in the TEMP directory, the TEMP directory itself is not deleted.
4) I include the full path and extension just for completeness sake.
Bob P.S. Thanks for your input, but can we drop the subject now?
Good point, forgot that applications also create directories in the TEMP folder. So, the quick and dirty Scheduled Tasks I use are now two:
c:\windows\system32\cmd.exe /c del %TEMP%\*.* /q /s
c:\windows\system32\cmd.exe /c rd %TEMP% /q /s
Thanks for amplifying,
Ugh! You still don't need C:\Windows\System32 - just cmd.exe, or even shorter, just cmd.
And you don't want that second one. That says to remove the %TEMP% directory altogether. Thereafter I suspect you'll see many failures in software as they probably assume that %TEMP% already exists.
Finally, the first one, del %TEMP%\*.* /q /s is sufficient as it will remove everything in %TEMP% including directories (due to the /s option).
Oh and it still doesn't get rid of files and directories that are open. I'm assuming you don't care about that.
On a slightly off tangent note, I use Process Explorer from Sys Internals (now part of MS) to find who has files/dirs still open. I find a lot of ~DF.tmp and Perflib_Perfdata_ files hanging out in %TEMP%. I have no idea why such files are open and I use Process Explorer to forcibly close them. It never seems to do any harm to the processes themselves. Process Explorer itself often has one of them Preflib files open. If anybody knows what causes such files to come into existence and how one might configure them to not be created then let me know. It seems to be related to performance related monitoring and really I do not wish to monitory performance nor have to clean up these silly files...
H
Han
"Bob Wang" wrote in news:zu6dndDrvbS3WtjanZ2dnUVZ snipped-for-privacy@comcast.com:
After all the foregoing, just alittle aside. Somewhere I found ATF cleaner. Choose what to clean, and it's done very fast. It's publisher's webpage (atribune.org) appears to be off right now, but Majorgeeks still seems to have the download. Not sophisticated, but free.
A
Andrew DeFaria
You're right! It doesn't. I don't use del anyway - I use rm.
But you are relying on that. If someday they are not present, poof, your %TEMP% is gone.
You sir can drop it any time you want. I, sir, will do what I please. I have no problems discussing technical issues. You seem to want to run, duck and cover. Why is that? Why not discuss technical issues, points and the like? What's wrong with that?
B
Bob Wang
SIGH!
You know, I TRY to be NICE by giving YOU some credit.
How you get clients is beyond me.
You're kill-filed AGAIN ;-)
1) The del /s command DOES NOT remove ALL directories for me.
You're right! It doesn't. I don't use del anyway - I use rm.
2) I need the rd command to remove directories like __SkypeIEToolbar_Cache
3) And, precisely BECAUSE there's Perflib_Perfdata_e4c.dat, ~DFBFF1.tmp and WCESLog.log in the TEMP directory, the TEMP directory itself is not deleted.
But you are relying on that. If someday they are not present, poof, your %TEMP% is gone.
4) I include the full path and extension just for completeness sake.
That's silly!
Bob P.S. Thanks for your input, but can we drop the subject now?
You sir can drop it any time you want. I, sir, will do what I please. I have no problems discussing technical issues. You seem to want to run, duck and cover. Why is that? Why not discuss technical issues, points and the like? What's wrong with that?
B
Bob Wang
Han:
Thanks, I'll definitely look into ATF cleaner.
Bob
After all the foregoing, just alittle aside. Somewhere I found ATF cleaner. Choose what to clean, and it's done very fast. It's publisher's webpage (atribune.org) appears to be off right now, but Majorgeeks still seems to have the download. Not sophisticated, but free.
B
Bob Wang
Han:
Thanks for the tip. Works like a charm. So, forget my cludge. ;-)
Bob
After all the foregoing, just alittle aside. Somewhere I found ATF cleaner. Choose what to clean, and it's done very fast. It's publisher's webpage (atribune.org) appears to be off right now, but Majorgeeks still seems to have the download. Not sophisticated, but free.
B
Bob Wang
Han:
Can you start a new thread linking this utility? I like how, when you run it under XP it says "ATF Cleaner for Windows XP" When run under Vista it says "ATF Cleaner for Windows Vista"
TWO THUMBS UP!
Bob
After all the foregoing, just alittle aside. Somewhere I found ATF cleaner. Choose what to clean, and it's done very fast. It's publisher's webpage (atribune.org) appears to be off right now, but Majorgeeks still seems to have the download. Not sophisticated, but free.
A
Andrew DeFaria
Yes, next time try that...
Because I'm good at what I do. Damn good! That's why!
Your loss...
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.