Monday, July 23, 2012

Understanding Temp Files

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).

No comments: