PDA

View Full Version : Understanding the temp folder and how to delete files in temp folder safely in window



shanmuga
11-07-2003, 05:49 AM
What files are there in temp folder?

1. Installation files. Two major components are files that need to be unpacked (de-compressed) before Setup can copy them to their final destinations and/or run them or refer to them (configuration files), and/or files that need to be stored temporarily until the next startup, since they cannot be copied to their final destinations (or a procedure cannot be performed) while Windows is loaded. This is the reason why the experts caution you to reboot before emptying the TEMP directory.

2. AutoBackup files. Files created by applications as between-saves backups in case the application, or Windows as a whole, crashes in mid-creation. Most applications have gotten better about it and no longer use the TEMP environment for this.

3. Another use is for logs that are constantly being updated as whatever
application they are logging runs. Error logs are another type. In some cases, you cannot delete these as they are "in use". In all cases, after rebooting they usually become worthless except for error tracking.

4. Files in mid-creation. Example: WinZip files. A 0-byte file is created, then as files are compressed, they are added to the temp file, and once the file is finished building, the final product is written to its final destination. These files cannot be deleted (at least not easily) while the file-building is in progress.

Nearly all of these files *should* be deleted by a well-behaved program when they are no longer needed. Major exception would be logs and error logs. Windows experts full recommendation for deleting TEMP files is to reboot, then review your situation:

Any lost files due to crashes that you might want to recover? Any errors that might have logs in the TEMP folder? Any user that might be in the habit of saving things to TEMP that shouldn't be?

So the correct procedure for entirely cleaning out the TEMP folder
should be.

1. Shut down and restart the computer. That will clean up anything
left by program installs and updates.
2. Immediately shut down again and this time restart in DOS mode.
3. Change to the TEMP folder (example: cd\windows\temp )
4. Enter one of the following commands:
DEL *.*
or
DELTREE /Y *.*

'Del' command deletes only the files in the selected folder, the files
with no System, or Hidden, or Read-only attribute set. It does not delete the subfolders in the selected folder either.

'Deltree' (i.e.: Delete Tree) command deletes all the files and
subfolders (regardless of their attributes), if they satisfy the command
line parameters (so, all files and subfolders -- if *.* is used).

sleddog
11-07-2003, 07:53 AM
That procedure is fine for a Windows 95/98/ME system, but doesn't apply to the newer Windows versions (2000/XP) which are NT-based. Simply because you can't "boot to DOS" on a WinNT box :)

For Windows 2000/XP I would suggest simply doing this:

A. Go to your temp folder using Windows Explorer [1];
B. Make sure the 'Details' view is selected (View menu, Details);
C. Click the 'Modified' column once, then again, so the little pointer next to 'Modified' points down. Files are now listed by date/time with the most recent at top;
D. Select all files older than the last time you restarted Windows. For example if you restarted today, select all files with a date/time of yesterday or before.
E. Delete them, and empty Recycle Bin.

[1]. Not sure what your "temp" folder is? Do this:

a. Open Windows Explorer;
b. Make sure the Address Bar is displayed: View menu, Toolbars > Address Bar;
c. For "Address", type in: %temp% and hit the 'Enter' key. You're there!

classicsoftware
11-07-2003, 08:05 AM
Download eraser at this link (http://www.tolvanen.com/eraser/download.shtml) and set the program up to delete the temp and temporary internet files as needed. There are also shutdown programs that wull do the same thing each time you shutdowm

shanmuga
11-07-2003, 11:41 AM
:cool: Thanks sleddog, forgot to mention,that procedure applies for win9x. Actually, i was going to follow up with a seperate post on XP temp files.Soon i hope :)


More on deleting temp files in Win9x


People will say 'one line in your autoexec.bat file'.........

Never put that line in Autoexec.bat as many programs during install will use the Temp folder and some programs require areboot to finish. Upon boot-up it looks for files it put there to finish upand you have now deleted them.

New program installs put files into the TEMP folder temporarily so
they can be moved to their final locations on the next startup. It is
done this way so as to allow for the installation of updated versions
of existing files that may be in active use by Windows. Files that
are in use cannot be updated or replaced.

That is why you are often prompted to reboot the computer when
installing new software or hardware; and why you sometimes see the
message about updating files and configuration settings when you first
start up the computer. This is done by a program called wininit.exe
which runs at every startup and which checks for an existing file
named wininit.ini. If wininit.ini is found the instructions in it are
processed to move the file and then wininit.ini is renamed to
wininit.bak

If the TEMP files were deleted at shutdown then these new files would
be included in the deletion and that would cause serious problems for
new software or hardware.

The only safe way to AUTOMATICALLY delete the TEMP files is to create
a batch file that will do this and then create a shortcut in your
Startup group on the Start menu to launch this batch file.

Do not do it from autoexec.bat or from a batch file called from
autoexec.bat. Autoexec.bat is processed BEFORE wininit.exe is run to
move the files from the TEMP folder.//

shanmuga
11-07-2003, 02:40 PM
Understanding Temp files in Windows XP

As XP is based Windows NT the handling of temp files is much different from the one in win 9x.There are two temp folders in winxp, one in the default windows folder and the other one in hidden folder local settings in the user's documents and settings. Till someone logs in, the temp is normally the one in windows.

You can delete all files in the TEMP folders by default. If they are still in use, Windows will not allow you to delete them so you will receive an error message for such files.

Try Disk Cleanup first. From the All Programs menu, choose Accessories, System Tools. If you use this option, Windows prompts you to select a local drive letter. To begin working directly with a local drive, right-click the drive icon in the My Computer window, choose Properties from the shortcut menu, and then click Disk Cleanup on the General
tab of the properties dialog box.Select or clear options from this list to make additional disk space available on the selected drive.
Most of the Disk Cleanup options are fairly self-explanatory and merely consolidate functions scattered throughout the Windows interface. For instance, you can empty the Recycle Bin, clear out the Temporary Internet Files folder, and delete files left behind by Indexing Service. (Avoid cleaning out the Downloaded Program Files folder, which contains generally useful ActiveX and Java add-ins.) Using these default settings, the Disk Cleanup utility is strictly an interactive tool. Each time you run the utility, you must select options you want to run and then click the OK button to actually perform the cleanup.


CAUTION The Disk Cleanup utility includes one confusing option that can leave an inordinate amount of wasted space on your hard disk if you don't understand how it works. When you run Disk Cleanup, one of the available options offers to delete Temporary Files - the accompanying Help text explains that these are unneeded files in the Temp folder. Unfortunately, this option may display a value of 0, evenif your Temp folder contains tens or even hundreds of megabytes of useless files. The reason? this value lists only files in your Temp folder that are more than one week old. If you want to completely clean this folder out you'll need to do so manually. To do so, do a reboot then close all running programs. Type %temp% in Start>Run dialog box; from the resulting Windows Explorer window, delete everything you find.

As you have rebooted, you can delete everything, on the otherhand If you want to be a bit more cautious, select the files as sleddog advices in his post earlier in this thread,and also a wait a few days before you empty the recycle bin of these files.


Select all files older than the last time you restarted Windows. For example if you restarted today, select all files with a date/time of yesterday or before.

Do you now wonder, which temp folder is opened when you run the %dir% command ?

%temp%
at
HKEY LOCAL MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ Explorer\Vol
umeCaches\Temporary Files

ie one in the user's local settings.

A well documented error when running cleanmgr.exe(disk cleanup in Windows) is disk Cleanup freezes While Compressing Old Files, which can be rectified,

1. By manually editing the registry - MSKB (http://support.microsoft.com/?kbid=812248).
2. Same edit as a tweakfromhttp://www.kellys-korner-xp.com/xp tweaks.htm and scroll| >>down to Line #48. In the right-hand window, click on| >>"Disk Cleanup - Compress Old Files Freezes".

Further Reference:

Disk clean up tool in Win XP (http://support.microsoft.com/?kbid=310312)

Disk cleanup tool may not delete temp files (http://support.microsoft.com/?kbid=261897)

How to automate the disk clean tool in Win XP (http://support.microsoft.com/?kbid=315246)//

Falkwl
11-08-2003, 07:18 PM
Appreciate all the above contributions regarding Temp and TIF.
That will help us to maintain our pc to run faster by not having
these two folders loaded with stuff that are not needed anymore.
Bravo to Shanmuga, Sleddog and Classicsoftware!
:cool:
Falkwl

jabarnutcase
11-09-2003, 08:20 AM
While we're on the subject of temporary files, does anyone know a good free download that will empty my index.dat files?
Sorry if I've asked this before. Seems to me I had this discussion a long time ago, (as have other people), but couldn't find what I wanted in a search).
Anyway, I downloaded a viewer and there are some old history URL's in there that I can't get rid of (locked so to speak)

Interestingly, nothing new....These are all from the year 2002.
I used to use PurgeIE but it is shareware. There were other programs like Spider and possibly Eraser as mentioned by Classicsoftware above, but they don't appear to be for Windows XP.

It is my understanding you can't just delete your Index.dat files while in windows, but there is a way to empty them. (Or get rid of them entirely and they will be rebuilt on next boot)

What do you guys recommend? I'll be gone for the day but will check in later for my spanking. :p

(Edit) And while I'm at it, I noticed 4 very strange sub-folders under the : Windows/temporary internet files folder...They are named as such:
G1AVO94R
IO2J6361
096VEN6H
VX09K160
:confused:
The strange thing, is on two other computers, I have the same folders but with different "names" ( made up of different numbers and letters than above)
These folders are empty, but are there none the less. What are they? Do you guys have them? Are they safe to delete? :confused:

ErnieK
11-09-2003, 08:51 AM
Originally posted by classicsoftware
Download eraser at this link (http://www.tolvanen.com/eraser/download.shtml) and set the program up to delete the temp and temporary internet files as needed. There are also shutdown programs that wull do the same thing each time you shutdowm

Be aware that when you use programs like this you might possibly have problems installing programs that require a re-boot, because this type of program leaves needed files sitting in the TEMP folder until after re-boot and then (supposedly) clears them at that point.


jabarnutcase.
While we're on the subject of temporary files, does anyone know a good free download that will empty my index.dat files?

The program I use is SPIDER. Works in all versions of windows.
www.fsm.nl/ward

classicsoftware
11-09-2003, 05:29 PM
First, eraser runs on demand not on shutdown. Secondly, the shutdown programs erase temp folders at shutdown not at re-start and even if they did, they alos offer the opttion to not do it. So either way unless you are extremely careless you will have no problems installing software with either method I use

mjc
11-09-2003, 06:10 PM
All this discussion fo the TEMP folder got me thinking....

It must have been designed under a government contract...only the mind of a bureaucrat could come up with something so permanent and still call it Temporary.....