Jump to content

Safe to Delete files in Windows\Temp folder


spacesurfer

Recommended Posts


Is it safe to delete files in C:\windows\temp folder in vista? I routinely did it for XP but in Vista, security box pop-up the first time I looked inside this folder.
Yes, it is safe to delete files in that temp folder.
Vista is crap thats why...I say just delete the contents of the temp folder and ignore the POS.
Just curious ...

With that opinion of Vista, why did you even bother to come into a section entitled:

Microsoft Operating Systems - Software Discussion & Support > Windows Vista

Are you actually the maintainer of the BBS linked in your signature?

I'll be sure to avoid that one when seeking advice.

shark

Link to comment
Share on other sites

With that opinion of Vista, why did you even bother to come into a section entitled:

Microsoft Operating Systems - Software Discussion & Support > Windows Vista

Because I was answering a question about Windows Vista.

Me hating the bloated POS doesn't mean people don't need help with it.

Are you actually the maintainer of the BBS linked in your signature?

Its not BBS its an Invision Power Board, the same type as MSFN.

No, I am not the maintainer, but I know plenty of people here have copied

Bold_Fortune's 4 years of hard work, and given him no credit whatsoever in

return. I think he deserves more credit than he gets, so I link to his forum.

I'll be sure to avoid that one when seeking advice.

Why, there's nothing on this MSFN forum, or indeed on the entire internet for that matter,

that comes remotely close to the level of detail on Bold_Fortune's site. If there was I would

probably be linking to it and not Bold_Fortune's site.

Link to comment
Share on other sites

Since the (POC) writers of Vista changed so many old time names of files and folders I'm sure surprised to hear that they didn't change Temp files to "Only needed today" files or sum such foolishness.

Temp files means "Temporary"......that means only needed while the creating program was still open and running.

After that they are just as much Garbage in Vista as they were in Windows 95, 98, 98/SE, ME, XP, 2K, NT, etc.

For more years than I want to count anymore, I've had a line in my startup files that deletes all temp files, temporary internet files and anything else I can find of a similar nature. How about Recent files, Prefetch files, cache files, AV Quarantine files? They are all junk and should be deleted on a very regular basis to keep your HD clean and running at peak efficiency.

Running windows "Disk Cleanup" on a regular (even daily) basis is a good place to start. There's still more junk that builds up on your HD that even Disk Cleanup won't delete. I didn't say "Can't",,,,I just said, "Won't".

Do a windows Search for *.log and see how many entries pop up. Most of those are temp files too.

Remember: "Minus Crud is Cool!" :thumbup

Andromeda43 :ph34r:

Link to comment
Share on other sites

You could just use CCleaner...

http://www.ccleaner.com/

v1.37.456 - [1st Feb 2007]

- Improved Vista compatibility.

Don't forget to untick Firefox and Opera (and IE if you use that, giggle)

otherwise you'll have to log back into all the forums you might be a

member of again.

Edited by LeveL
Link to comment
Share on other sites

Ignorance runs high.

C:\Windows\Temp or \WINNT\Temp in 2000 has always been a restricted folder that non-admin users can't open. Vista accounts default to non-admin "Admins" which means you are a non-admin and admin tokens are only used when needed, hence the UAC prompt. It's just a secure way of using ANY modern operating system, which many people like LeveL don't approve of yet complain about security.

Link to comment
Share on other sites

The root's tmp folder in Linux performs the same way.

Folks just aren't used to an operating system designed for both use AND security. You can still clean it out but just a few extra steps are in order, and that's a good thing.

Link to comment
Share on other sites

Here is a VBS script to delete all the files and none system folder in the temp directory

Save As CleanTemp.vbs

 Dim Act, Arg1, File, Folder, Fso, StrF,WMI
Set Act = CreateObject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
Set Folder = Fso.GetFolder(Act.ExpandEnvironmentStrings("%SystemRoot%\Temp"))
Set File = Folder.Files
'/-> Collect The Files In The Temp Folder
For Each StrF In File
Set Arg1 = Fso.GetFile(StrF.Path)
If Fso.FileExists(Arg1.Path) Then Arg1.Delete() End If
Next
Dim Computer : Computer = "."
Set WMI = GetObject("winmgmts:\\" & Computer & "\root\cimv2")
Set Folder = WMI.ExecQuery("Associators of {Win32_Directory.Name='" & Folder.Path & "'} " _
& "Where AssocClass = Win32_Subdirectory ResultRole = PartComponent")
'/-> Collect The Folders In The Temp Folder
For Each StrF in Folder
Set Arg1 = Fso.GetFolder(StrF.Name)
If Fso.FolderExists(Arg1.Path) Then
'/-> Deletes Only None System Folders
If StrF.System = 0 Then Arg1.Delete() End If
End If
Next

Link to comment
Share on other sites

Kewl !

I love scripts. I use them every day in my own PC tuneup business.

They can just be tailored to do so many neat things.

Like shutdown redundant services, delete old restore points, etc.

But, for a home user that doesn't have to worry about corporate or Office security,

why not just shut off that very annoying Security Warning popup?

That was the first tweak I did to my own Vista machine.

And also give that same user the highest Admin priority possible.

Another "Must-DO" for home users (and the tech that has to support them).

Now there's a great idea for a VBScript! Any script writers ready to jump on that one?

I know that many of us non-script-writers would sure be very thankful.

:ph34r:

Link to comment
Share on other sites

And also give that same user the highest Admin priority possible.

I can not be sure but you can not script something like that. It possible I think

to use the run as in a script, but do not quote me on that.

If you have some ideas about what you would like to script to do I might try

and write a couple for you.

Here is a simple script that list the install date and the last boot time

Save As Install_LastBoot.vbs

strComputer = "."
Dim Wmi :Set Wmi = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Dim Dtm :Set Dtm = CreateObject("WbemScripting.SWbemDateTime")
Dim BootTime, ColItem, CreationTime, ObjItems, Var1
Set ObjItems = Wmi.ExecQuery("Select * from Win32_OperatingSystem")
For Each ColItem in ObjItems
Dtm.Value = ColItem.InstallDate
CreationTime = Dtm.GetVarDate
Dtm.Value = ColItem.LastBootUpTime
BootTime = Dtm.GetVarDate
Var1 = ColItem.Caption & " - " & ColItem.Version
Next
MsgBox "OS Install Date" & vbTab & Chr(187) & " " & CreationTime & vbCrLf &_
"OS Boot Up Time" & vbTab & Chr(187) & " " & BootTime,4128,Var1

Link to comment
Share on other sites

I wouldn't recommend automating the deletion of files & folders in a temporary folder that is also an environment variable - the main reason being that some processes may put "post-boot" files in there to perform some operations after the OS is restarted (due to file locks or services that cannot be restarted at that time).

So if your clever deletion routine kicks in before the process is called, it never finishes its work and you leave the system in an unknown, possibly unstable state.

By all means check manually every so often after a clean reboot and check for files that have been clearly left behind after an application crash (or poorly programmed application) - the modified date on the files is the best indicator.

Link to comment
Share on other sites

I wouldn't recommend automating the deletion of files & folders in a temporary folder that is also an environment variable - the main reason being that some processes may put "post-boot" files in there to perform some operations after the OS is restarted (due to file locks or services that cannot be restarted at that time).

So if your clever deletion routine kicks in before the process is called, it never finishes its work and you leave the system in an unknown, possibly unstable state.

By all means check manually every so often after a clean reboot and check for files that have been clearly left behind after an application crash (or poorly programmed application) - the modified date on the files is the best indicator.

Here is a VBS script that will delete the files or folders 2 days after they where created

Sace As CleanSysTemp_2.vbs

 Dim dtmDate, ObjD, StrC, StrD, StrM, StrTD, StrY, Wmi
Dim Act, ColItem, Folder, Fso, ObjItem
'/-> Change This To Suit Your Needs
dtmDate = Date - 2 '/-> Amount Of Days
StrD = Day(dtmDate)
StrM = Month(dtmDate)
StrY = Year(dtmDate)
StrC = "."
'/-> Add A Zero To The Date If Needed
If Len(StrD) < 2 Then StrD = "0" & StrD End If
If Len(StrM) < 2 Then StrM = "0" & StrM End If
StrTD = StrY & StrM & StrD
Set Act = CreateObject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
Set Folder = Fso.GetFolder(Act.ExpandEnvironmentStrings("%SystemRoot%\Temp"))
Set File = Folder.Files
Set Wmi = GetObject("winmgmts:\\" & StrC & "\root\cimv2")
'/->
CleanUpFilesInTemp()
Function CleanUpFilesInTemp()
Set ColItem = Wmi.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='" & Folder.Path & "'} Where " _
& "ResultClass = CIM_DataFile")
'/-> Delete Files That Havnt Been Access In 2 Days
For Each ObjItem In ColItem
ObjD = Left(ObjItem.CreationDate, 8)
If ObjD < StrTD Then : ObjItem.Delete : End If
Next
End Function
'/->
CleanUpFoldersINtemp()
Function CleanUpFoldersINtemp()
Set ColItem = WMI.ExecQuery("Associators of {Win32_Directory.Name='" & Folder.Path & "'} " _
& "Where AssocClass = Win32_Subdirectory ResultRole = PartComponent")
'/-> Collect The Folders In The Temp Folder
For Each ObjItem in ColItem
Set Arg1 = Fso.GetFolder(ObjItem.Name)
If Fso.FolderExists(Arg1.Path) Then
'/-> Delete Folders That Havnt Been Access In 2 Days
ObjD = Left(ObjItem.CreationDate, 8)
If ObjD < StrTD Then
'/-> Deletes Only None System Folders
If ObjItem.System = 0 Then : Arg1.Delete() : End If
End If
End If
Next
End Function

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...