Friday, March 22, 2013

Forty Ways To Free Up Disk Space


Forty Ways To Free Up Disk Space

817 out of 1206 rated this helpful
Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.


You've probably heard the Paul Simon song "Fifty Ways to Leave Your Lover," which describes a number of tricks for breaking free from an undesired relationship. This article places a spin on the concepts used in that song.
No, I can't guarantee that simply by reading this article you'll meet that special person. But This article will provide 40 ways to solve some common disk-space problems under Windows 9x and Windows NT.
A simple lack of disk space is the most common disk-space problem. If your hard disk drive's property sheet looks like the one shown in Figure A, you probably have more space than you might guess—it's just currently occupied by various sorts of Windows junk (and occasionally some junk of your own). Let's take a look at some of the debris clogging your system and how you can pare it away.
Cc750370.freedisa(en-us,TechNet.10).gif
Figure A: Having no available disk space is a sad situation.
On This Page

What junk to go after

You have several means of gaining back disk space on a Windows system. The basic methods are:
  • Manual deletion of unwanted programs
  • Manual deletion of unwanted files
  • Manual file compression
  • Application parameter control
  • Disk compression
  • Defragmentation
I'll detail each of these topics more thoroughly as we go along. Our basic approach will be to first remove and compress as many files as possible, and then (maybe) to compress the disk and run a defragmenter to gain back the greatest possible amount of space.
Caution: Use these procedures only if you're comfortable with them and only after backing up your system. Several of these steps fully remove files, and there will be no way to retrieve them without a backup.

Manually deleting unwanted programs

(1) The biggest area of waste on the average Windows PC lies in unused programs. To address this issue, begin by opening Control Panel and double-clicking the Add/Remove icon. Then, remove everything you don't use. Review the programs that you use infrequently, to see if you can move them to a zip drive or similar removable device. When I talk about moving unused programs to a zip drive, you must of course uninstall them and reinstall them onto the removable device. (It's sad that we simply can't copy applications anymore, isn't it?) Make sure you copy to tape or disk any data files from these applications that you might need again later.
Next, use Windows Explorer to (2) visually check your disk for the programs you've just uninstalled. In many cases, uninstall programs won't remove all the directories associated with the applications on the disk—especially if they contain user-generated data files. Sometimes, uninstallers remove only the core application executable files and their keys from the registry, leaving all the other files behind. As you manually inspect the disk with Windows Explorer, you can delete these directories.
The Add/Remove Programs utility doesn't contain information about all the programs installed on your PC. (3) So, double-click the My Computer icon, double-click each hard drive, and inspect the application folders, searching for useful uninstall programs or any additional files you'd like to get rid of. You might want to use Windows Explorer again here, to (4) tool through the disk directories directly.
Perform this removal process in the order I've described. Doing so will ensure that you take advantage of any uninstall programs that will also remove the respective application keys from the registry—otherwise, the registry might behave as though programs you've deleted still exist.

Manually deleting unwanted files

The next biggest area of waste is user- or system-generated files that are no longer important. The following file types are ripe for deletion (once you've agreed you don't need them):
  • (5) *.bak—Backup files.
  • (6) *.tmp—Temporary application files.
  • (7) *.~*—Temporary application files.
  • (8) ~*.*—Usually Microsoft work files.
  • (9) *.old—Needs no explanation.
  • (10) *.bkp—Backup files.
  • (11) *.$$$—Work files.
  • (12) *.diz—Marketing files that come with shareware programs.
  • (13) Readme.txt—Startup files that accompany most packages.
  • (14) MSCreate.dir—Small control files Windows places into directories you create.
  • (15) *.gid—Hidden index files created when you first access Windows 95 help files. These can really eat up space, as Figure B shows. If you haven't used the associated help file for a while, you can consider deleting the GID files. Windows will re-create them the next time you access the help file.
    Cc750370.freedisb(en-us,TechNet.10).gif
    Figure B: GID files can consume lots of space.
To delete these files, open the Find Programs dialog box by choosing Find from the Start menu and then selecting Files Or Folders from the submenu. Search for the file types in the order I've listed them.
Don't overlook the chance to get rid of small files when you can. Small files consume at least one full disk sector, which means that a one-byte file will use up 16 KB (or even 32 KB on a large disk).
(16) You might want to peek at the C:\Windows\Temp directory, where many programs deposit junk or work files. Delete whatever you can verify as unnecessary. (17) Also, many applications set up and use a \Temp directory or another user-defined directory on the C drive to store the temporary files from Windows. To determine where a user is storing temporary files, open an MS-DOS prompt window, type set, and press [Enter]. The Set command's resulting output will indicate the location of \Temp directories where you can look for and delete junk.
Also get rid of the basic fluff that comes with Windows itself. These unnecessary items include (18) AVI files in the C:\Windows\Help directory, (19) unwanted screen savers,(20) wallpaper bitmaps, (21) themes, and (22) sound files.

Manual file compression

(23) Under Windows 9x, you can compress an entire hard disk drive (as we'll explain later). However, this feature occasionally runs into corruption problems and isn't available "out-of-the-box" on Windows NT systems. A more time-honored tradition is to use a third-party compression utility to gather smaller files into one larger archive file. You can open this archive and break it down into the smaller component files as necessary. (The Web sites http://www.pkware.com (of PKZIP fame) and http://www.winzip.com both offer nice Windows compression programs._

Controlling application parameters

Empty the cache areas of your Internet browsers. The cache stores local copies of Internet Web pages you've browsed, for rapid retrieval the next time you visit the same site. You'll find graphic files (.gif,.jpg) here, as well as cookies and actual Web pages.
Netscape users can set aside a physical percentage of the disk drive in which to store these cache files—usually 5 MB. To erase this cache, look at the Net3\cache or Net4\cache folder. (24) To change the options, choose Network Preferences from the Options menu to open the Cache dialog box and make the necessary adjustments.
Microsoft's Internet Explorer (IE) uses a less desirable mechanism to determine cache size: a percentage of disk space. One percent is the minimum. So, if you're low on space and need to browse the Web, you can be sure IE will help finish you off by loading up the cache. IE places these cache files in the \Windows \Temporary Internet Files folder. You can view files in this directory but not delete them directly. (IE hides dated directories in this folder as well, which are hidden by default.) (25) The best way to remove these files is to choose Internet Options from the View menu to open the Internet Options dialog box, shown in Figure C. Then, click Delete Files to clear the cache. Not all the files are cleared from the cache, including cookie files (which, admittedly, are fairly small). (26) Now, click Clear History to remove the URL history list of past sites you've visited. If you browse a lot, this list can be quite large.
Cc750370.freedisc(en-us,TechNet.10).gif
Figure C: Change cache settings in the Internet Options dialog box.
(27) Click Settings in the Internet Options dialog box to verify the percentage of disk space set aside for the cache. Set it to one percent, or whatever percentage you'd like.

Disk compression

(28) The Windows DriveSpace disk-compression tool will effectively set up your disk as a massive PKZIP archive. To start this utility, choose Programs from the Start menu, and then select Accessories | System Tools | DriveSpace from the submenu. DriveSpace can return a large percentage of space to your system, but it may make the files inaccessible to other systems on your network. Use this option with caution.

Cleanup

You can use a small program to empty the Recycle Bin (29) (it's really just a special directory on the root of the C drive). The C header code to do so looks like this:
SHEmptyRecycleBin
SHSTDAPI SHEmptyRecycleBin(
HWND hwnd, 
LPCTSTR pszRootPath, 
DWORD dwFlags
);
However, you must install the Explorer 4.0x extensions (such as channels) to get the required version 4.71 of the Shell32.dll file to make the call. I, for one, am not interested in installing tons (read that, megabytes) of glut just to be able to delete files from one directory.
So, let's look at a batch file that does the same thing. Note that the recycle directory contains two special, hidden files. Info maps the names of files in the Recycle Bin to their original filenames; you should delete this file. The shell uses Desktop.ini to recognize that the Recycle Bin is a special folder; don't remove this file.
(30) Place the following lines within a batch file called, perhaps, Dump.bat:
C: 
CD\RECYCLED
ATTRIB -h *.* 
ATTRIB +h desktop.ini 
ECHO Y | DEL *.* > NUL: 
You can now empty the Recycle Bin by calling this file.

ScanDisk

Files can become corrupted on a Windows PC for many reasons: A program may stop responding while it's trying to create a printer spool file, a user might turn off the PC while it's trying to process a chunk of data, and so on. Fortunately, a temporary (or copy of) file usually goes bad in these situations, so the most you're losing is space. You can correct many such file problems by running ScanDisk (31).
To access this utility, double-click My Computer, right-click the desired drive, choose Properties from the shortcut menu, and click the Tools tab. Click Check Now to run ScanDisk. I've seen PCs with as much as 45 MB of space tucked away in corrupted files—and some fairly happy users when they get all this space back.
One of the ScanDisk options lets you convert lost file fragments to files. Instead of directly freeing the bad file space, the system will save the data in the corrupted files to files on the root of the drive being scanned. These saved files are named sequentially as File0000.chk, File0001.chk, and so on. Afterward, if you're skilled at picking through binary files, you can recover data—or at least verify the original contents of the corrupted file. If you aren't so skilled, or if you're ready to delete these files, be sure to (32) remove the File*.chk files from the roots of all your drives. Otherwise, you'll have saved the space in the corrupted files rather than releasing it.

Spool files

(33) Use Windows Explorer to check the C:\Windows\Spool directory, where previously faxed or printed documents may have left behind some junk files. In some cases, these files can be fairly large.

Mail files

(34) Check your mail files and remove any large attachments. Delete any unused mail messages. Make sure your mail system doesn't use a two-stage deletion process, like Internet Mail. If it does, empty the deleted mail files receptacle, as well. Compress your mail file to return the unused space. (I've seen this technique return as much as 67 MB to a user system.)

Database files

(35) Compact any large, locally stored databases. In Microsoft Access 2.0, choose Compact Database from the File menu for details. In Access 7.0, choose Database Utilities from the Tools menu and then select Compact Database from the submenu.
In Visual Basic, you can do the same thing by using a program:
DBEngine.CompactDatabase _
olddatabase, _
newdatabase [, locale [, options]]

Vendor installation files

(36-37) Remove the AVI files, help files, and backup installation programs left over on new machines. Once the system has been running for a while, you won't need the 12 MB of hardware-vendor-specific marketing often provided with a new PC.

Defragmentation

Defragmentation "shuffles" files on the hard drive to regain space lost through the daily creation and removal of files. When you create a small file, it uses a full disk sector (between 2 KB and 32 KB, depending on the size of your disk drive) to store itself. If you're low on disk space and Windows doesn't have enough room to store a large file, it may break the file into small enough chunks to fit the available space (or you may simply run out of disk space). Breaking up files in this way slows down the access time of the files (your PC runs slower) and wastes a lot of disk space.
(38) Defragmentation will reorder the files on the disk, placing large files into adjacent pieces and reducing the consumption of sectors by smaller files. I've seen savings of as much as 12 MB on a 4-GB drive, which had been previously cleaned using all the steps I've listed so far, simply by defragmenting the disk. You access this utility as you do ScanDisk: Double-click My Computer, right-click the desired drive, choose Properties from the shortcut menu, and click the Tools tab. To start defragmentation, click Defragment Now.
Note that this utility will work around hidden files and, as a result, won't be able to fully optimize the space around or in them. And, Windows hides a lot of files during the normal course of its business. (39) If you're truly feeling industrious, you can unhide certain files so that Windows can defragment them as well. Of course, you do not want to unhide system files, such as the registry files (System.dat, User.dat, and *.dat). However, you can unhide GID files or anything else that resembles junk, as defined earlier.
To unhide files, simply enter the following lines in a batch file named something like Hidden.bat:
CD\
DIR /AH /S /B
You can also unhide a file by right-clicking the file in Explorer, choosing Properties, and clearing the Read-Only, System, and Hidden check boxes in the resulting dialog box.

Conclusion

Of course, this article doesn't represent every way to recover space on a Windows 9x PC. So that everyone can continue to benefit, I've created a Web page where readers can contribute new ideas that we can all share. (40) See  for future updates.
Bill Shadish is a principal of Fundamental Objects, Inc., where he works with ActiveX controls and OLE Server technology. Bill is an active Visual Basic and Lotus Notes instructor. He writes for a number of VB trade journals, including Inside Visual Basic, Visual Basic Developer, Visual Basic Programmer's Journal, and Visual Programming++. Bill has co-authored several books and is working on a new one (from Wiley Publishing) called 15 Projects You Can Do with SQL Server. You can reach him at bills@fo.com.
We at Microsoft Corporation hope that the information in this work is valuable to you. Your use of the information contained in this work, however, is at your sole risk. All information in this work is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Microsoft Corporation. Microsoft Corporation shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

No comments:

Post a Comment