Microsoft

Get rid of stray temporary files and folders in Windows 98

Windows 98 Disk Cleanup is not a complete solution for ridding your system of unwanted temporary files and folders. This article describes some brute force techniques you can employ to truly rid a system of stray files and folders.


Among it’s other clean-up tasks, the Windows 98 Disk Cleanup utility will scan Windows 98’s Temp folder, identify any files and folders that aren’t currently being used, and allow you to remove them. However, over the years of supporting Windows 98, I’ve discovered that Disk Cleanup often is unable to remove all the stray files and folders. Once that happens, these stray files and folders become a permanent addition to the Temp folder and can wreak all sorts of havoc on the operating system—from something as annoying as sluggish behavior to something as devastating as a system crash.

When Disk Cleanup is unable to perform its duties, you’ll need to employ what I call the brute force method of cleaning out the Temp folder. In this article, I’ll show you how to find out if Disk Cleanup is failing to remove stray files and folders from the Temp folder on your hard drive. Then, I’ll show you how to manually clean out the Temp folder.

Too many stray temp files and folders
In order to juggle all of the tasks that an operating system is responsible for, Windows 98 creates temporary files and folders and uses them to store data while it’s working. For example, Windows 98 creates temporary files each time you load an application, open a document, or install new software. As a general rule, Windows 98 is supposed to delete these temporary files and folders (which it keeps in the C:\WINDOWS\TEMP folder) when it closes the application, document, or completes the installation procedure.

However, on many occasions, Windows 98 fails to delete the temporary files or folders when it’s supposed to. This typically happens when an application or the operating system itself crashes. When this occurs, the operating system basically forgets that these temporary files and folders exist and goes on about its business, which of course means (among other things) creating more temporary files and folders. As you can imagine, over time, these stray temporary files and folders will accumulate and waste valuable disk space. In addition to wasting space, these stray temporary files and folders can interfere with Windows 98’s operating system management duties. To help with this clean up job, Windows 98 comes with a special utility called Disk Cleanup, which works some of the time. When it doesn’t do the job well, however, you’ll need to resort to brute force to empty out your Temp folder.

Establish the baseline
The first thing that you need to do when cleaning out the Temp folder is establish a baseline. To do so, you’ll need to manually check out the contents of the Temp folder to see what, if anything, is there. In order to get a clean look at the Temp folder, you should shut down all open applications, and then restart your system. Doing so will ensure that any temporary files or folders currently being used are flushed from the Temp folder.

Once the system restarts, launch Windows Explorer to locate the C:\WINDOWS\TEMP folder on the Folders tree in the left-hand pane. As soon as you do, right-click on the Temp folder and select the Properties command. At this point, take note of the number and size of all the files and folders in the Temp folder.

For example, on one of my test systems, the Temp Properties dialog box informed me that the Temp folder contained 15 files and 6 folders that occupied 4.33 MB of space in the hard disk, as shown in Figure A.

Figure A
You can quickly ascertain the contents of the Temp folder from within the Properties dialog box.


Now, this really isn’t an inordinate amount of disk space, considering the size of today’s hard disks; however, if these are stray files and folders, they can quickly add excess overhead to the operating system’s management of the Temp folder. At this point, click OK to close the Temp Properties dialog box and then close Windows Explorer.

File and folder dates
The time and date stamps of the files and folders in the Temp folder can also indicate which are strays. For example, if you find files and folders dated several months ago, there’s a good chance that those files and folders are strays.

Testing the Disk Cleanup utility
Now that you know the exact amount of space that's being used by the Temp folder, let’s take a look at how Disk Cleanup evaluates the situation. You’ll want to run the Disk Cleanup utility as you would under normal circumstances. When you see the Disk Cleanup dialog box, take note of the amount of space that Disk Cleanup reports on the Temporary files line. On my example system, Disk Cleanup reports finding less than 1 MB, as shown in Figure B.

Figure B
Disk Cleanup reports that the Temp folder contains less than 1 MB of unnecessary files.


As you compare the amount disk space that Disk Cleanup reports and the amount you noted when you manually checked the Temp folder, keep in mind that there will always be a slight discrepancy between these figures because Disk Cleanup won't report any Temp folder files that currently are in use.

Now, as you’ll remember, on the manual check of the Temp folder, I found 4.33 MB of space being used. However, Disk Cleanup reported less than 1 MB of stray files and folders. While I mentioned that it’s possible that a slight discrepancy exists, it’s highly unlikely that you’d see such a large discrepancy—especially after you just restarted your system. There’s a good chance, therefore, that the Temp folder contains stray temporary files and folders that Disk Cleanup is unable to identify and remove. Even so, go ahead and select the Temporary files check box and click OK. When you do, Disk Cleanup will remove the stray files and folders that it finds from the Temp folder.

Manually cleaning up stray files
In order to manually remove the stray files and folders from the Temp folder, you’ll need to restart your system in MS-DOS mode. To do so, click the Start button and select the Shut Down command. When you see the Shut Down Windows dialog box, select Restart The Computer In MS-DOS Mode and click Yes.

MS-DOS Mode
When you restart your system in MS-DOS mode, Windows performs a quick shutdown in which all running programs are removed from memory, the GUI closes, and a DOS prompt is displayed. However, keep in mind that the Windows VXD bootstrap layer remains in memory, so that the GUI can quickly be restarted when you type EXIT.

Once you see the DOS prompt, removing stray files is easy. To begin, change to the C:\WINDOWS\TEMP folder by typing the command:
cd \windows\temp

Then, to delete all the files in the folder, type the command:
del *.*

When DOS prompts you, type Y and press [Enter] to delete all the files in the directory.

Keep in mind that there may be stray files in the Temp folder that have the hidden attribute enabled. Hidden files are immune to the DEL command shown above. To check for the existence of hidden files, you’ll need to use the command:
dir /ah

where the /AH parameter configures the DIR command to display any files with the hidden attribute enabled. If you find any, you’ll need to use the ATTRIB command to disable the hidden attribute. To do so, you’ll type the command:
attrib –h filename

where filename is the name of the file. You can then use the DEL command to delete the file.

Eliminating stray folders
Once you’ve deleted all the files in the Temp folder, you’ll want to look for stray folders, which could contain more stray files. To determine whether your Temp folder contains stray folders, type the command:
dir /ad

where the /AD parameter configures the DIR command to display only a listing of folders. This command will also display folders with the hidden attribute enabled. If you see any stray folders inside the Temp folder, you’ll need to remove those as well. To do so, you’ll use the DELTREE command, which will remove folders with the hidden attribute enabled. For example, the Temp folder on my example system contained six stray folders named:
  • _ISTMP1.DIR
  • _ISTMP2.DIR
  • _ISTMP3.DIR
  • PL4421.TMP
  • CDMINST
  • TEMPTOO

As you can see, four of these stray folders are actually named with extensions, which is common for the types of folders found in the Temp folder. Removing stray folders with the same extension is easy. To remove these folders and all the files in them, you’ll type the command:
deltree *.dir

However, keep in mind that when you use the DELTREE command, you’ll be prompted to confirm each folder delete operation. To remove the other stray folders, you’ll need to use these separate DELTREE commands:
deltree pl4421.tmp
deltree cdminst
deltree temptoo


Once all the stray temporary files and folders are deleted, you can restart Windows by typing EXIT on the command line.

Freeware to the rescue
If you discover that your Windows 98 system regularly accumulates stray temporary files and folders, and you get tired of using the brute force approach of removing them, you may want to investigate EraseTemp. This cool freeware program from No Design Software automatically deletes stray temporary files and folders from your computer. However, rather than deleting all stray temporary files and folders, EraseTemp only deletes those that are older than one day.

Keep in mind that in order to run EraseTemp, you’ll need to install the Microsoft .NET Framework Redistributable. You can learn more about and download the Microsoft .NET Framework Redistributable from the Microsoft MSDN Web site.

More information
If you would like to learn more about the Disk Cleanup utility, check out these Windows 98 pages on Microsoft’s site:

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

Editor's Picks