Windows XP comes with a tool called Disk Cleanup, which is designed to search for files on your hard disk that you can safely remove. Running the Disk Cleanup tool allows you to free up disk space by performing the following tasks:
- Remove temporary Internet files
- Remove downloaded program files
- Empty the Recycle Bin
- Remove Windows temporary files
- Remove optional Windows components you are not using
- Remove installed programs that you no longer use
However, one thing Disk Cleanup doesn't do is alert you to empty folders on your hard disk. That would be useful because, even though empty folders don't occupy much space, the operating system and other disk-based utilities still have to keep track of and manage them—and that can waste time and resources.
Although you can open Windows Explorer and begin traipsing around your hard disk in search of empty folders, that's an extremely time-consuming and frustrating operation. So I recently decided to sit down and create a utility that uses VBScript and Windows Script Host to scan an entire hard disk or a specified path and compile a report of all the empty folders found. This tool, Empty Folder Tracker, then allows you to delete each empty folder. Empty Folder Tracker is compatible with all versions of Windows.
Download Empty Folder Tracker
You can download the Empty Folder Tracker utility by following this link or by clicking on the Downloads link in the navigation bar on the left side of this page. TechRepublic and TechProGuild have many useful documents, templates, and applications available for download, so be sure to check out our other offerings. To increase download speed, we've zipped the Empty Folder Tracker files together. You'll need an unzip utility, such as WinZip or PKZIP, to expand the zipped file. Because many antivirus programs automatically filter out VBS files, the download includes a file called EmptyFolderTracker.txt. Once you download and unzip the file, you'll need to rename it EmptyFolderTracker.vbs.
Where do empty folders come from?
At first glance, asking where empty folders come from seems pretty silly, but the answer is a bit more complex than you might think. There are actually three sources for empty folders. Let's take a closer look.
The most obvious source of empty folders is a faulty uninstall operation. When you run an application's uninstall routine or use the Add/Remove Programs tool in the Control Panel, you expect that the procedure will remove not only the application files, but all of its folders, shortcuts, and registry entries. However, we all know that's not always the case.
If you've ever been on a registry editing operation, chance are you've encountered remnants of an application you removed long ago And who hasn't found an empty folder or a floundering shortcut on the Start menu? If the uninstall routine left this kind of residue behind, it's not a far stretch to imagine stray empty folders being left behind too. Now, don't get me wrong here—not all this garbage is left behind by sloppy programming. Some of this stuff is the result of a lockup, a crash, or some other strange behavior that occurred during the uninstall procedure.
Of course, we also create some empty folders. You know the drill—you create a folder for some of your data files and then later move the files but forget to go back and delete the now empty folder.
Another source of empty folders is the application installation procedure. In this case, the procedure creates an empty folder as a placeholder for temporary or other configuration files that get created when you run/use the application.
For example, Office XP creates an empty folder called Startup in the Program Files\Microsoft Office\Office10 folder, which can be used for storing templates containing macros you always want to have available in Word. However, if you, or another application, never put a template in the Startup folder, it will remain an empty folder.
Empty folders are also created by the operating system installation procedure. Again, these empty folders are placeholders to be used for temporary or other configuration files that get created as the operating system does its job. As you would expect, many of these empty folders are found in the Windows folder tree.
Some of these empty operating system folders are marked as system folders, so they're undeletable. When you attempt to delete these types of folders, you'll encounter an error message.
Other empty operating system folders can be deleted but are automatically re-created when you reboot the system. Still other empty operating system folders that can be deleted will be only recreated when the operating system needs them.
Be careful, though: There may be some empty operating system folders that can be deleted but that aren't automatically recreated, which could ultimately cause you problems. So it's extremely important to exercise caution when deleting empty folder related to the operating system.
Are empty folders really wasteful?
Empty folders don't really occupy space on the hard disk, but they do constitute an entry in the file allocation table, which means that a block of hard disk space is allotted to that folder regardless of whether it contains any data. Since the space is allotted, no other file or folder can occupy that space, which could be considered wasteful.
In addition, since that space is allotted, it is included in and must be managed in any disk operations you perform, such as copying and moving, searching, backing up, error checking, and defragmenting. Although managing a handful of empty folders isn't much of a strain, when the number reaches several hundred, the extra overhead can make a difference in performance.
Installing the Empty Folder Tracker utility
Let's turn our attention now to putting the Empty Folder Tracker to work. Once you download the EmptyFolderTracker.zip archive file, manually installing the utility on your hard disk is easy. To do so, create a folder anywhere on your hard disk and name it something like EmptyFolderTracker. Then, unzip the EmptyFolderTracker.zip archive file and copy the four files to that folder:
Because many antivirus programs automatically filter out VBS files, the download includes a file called EmptyFolderTracker.txt. You must rename it EmptyFolderTracker.vbs. EmptyFolderTracker.vbs is the main file and the one that you'll use to launch the utility. (You can create a shortcut to this file on your desktop if you want.) The Progress.htm and Progress.gif files are used to create a progress indicator.
Running the Empty Folder Tracker utility
To use the tool, first locate the EmptyFolderTracker.vbs script file and double-click on it. You'll momentarily see a splash screen as the utility loads. Then, you'll see the first dialog box, which prompts you to enter a drive or path on which you want to search for empty folders, as shown in Figure A.
|The first dialog box of the Empty Folder Tracker utility prompts you to enter a drive or path.|
Depending on the size of the hard disk or the number of folders in the path you entered, Empty Folder Tracker may take some time to compile the results of its search. This occurs in the background, but you'll see the animated progress indicator, shown in Figure B.
|The animated progress indicator lets you know that the Empty Folder Tracker is busy in the background.|
When Empty Folder Tracker finishes its search, it will briefly display the dialog box shown in Figure C. As you can see, this dialog box informs you of the number of empty folders that the utility found.
|Empty Folder Tracker will display the number of empty folders it found.|
After this dialog box disappears, you'll see a detailed report of all the empty folders in a maximized Notepad window. Another dialog box will quickly appear on top of this window, asking whether you want to begin deleting folders, as shown in Figure D.
|The report display is overlaid with a dialog box that asks whether you want to begin deleting folders.|
If you want to delete empty folders but you'd like to study the report first, simply select the Notepad window title bar. The Empty Folder Tracker dialog box will drop to the background, where it will wait for you to continue. You can scroll though the report and study it onscreen or print it for more detailed analysis. You may also want to launch Windows Explorer and manually investigate some of the empty folders displayed in the report. If you don't want to delete empty folders at this point, just click No in the Empty Folder Tracker dialog box; you can still view or print the report.
If you click Yes, you'll see a dialog box that displays an empty folder and prompts you to delete it, as shown in Figure E. Click Yes here, and Empty Folder Tracker will delete the empty folder and display the next empty folder in the list. If you don't want to delete the folder, just click No. Empty Folder Tracker will skip over that folder and display the next one in the list. If you want to stop deleting empty folders at any point, just click the Cancel button.
|Empty Folder Tracker will individually prompt you to delete every empty folder that it finds on the hard disk.|
When you reach the end of the list, Empty Folder Tracker will display the dialog box shown in Figure F to determine whether you want to cycle through the list again. If you click No, Empty Folder Tracker will stop processing the list. If you click Yes, it will start at the beginning of the list and display any empty folder you bypassed the first time around, as well as any folder that has just become empty as a result of deleting its subfolder. The latter would be the case if you had a chain of empty folders. For example, suppose that you had the following chain of empty folders:
The first time around, Empty Folder Tracker would find only the Four folder empty. Once the Four folder was deleted on the first iteration of the list, Empty Folder Tracker would find the Three folder empty on the second iteration of the list, and so on.
|When Empty Folder Tracker reaches the end of the list, it displays this dialog box.|
Now, as I mentioned earlier, the Windows operating system considers certain empty folders to be system folders and won't allow you to delete them. If you attempt to delete one of these folders from within Empty Folder Tracker, you'll see an error dialog box like the one shown in Figure G.
|When Empty Folder Tracker attempts to delete a folder protected by the operating system, it will display an error message.|
When you finish deleting folders, Empty Folder Tracker will ask whether you want to view a report of the folders you deleted, as shown in Figure H. If you click Yes, you'll see the report, as shown in Figure I. That way, you can keep track of which folders you deleted. If you discover that you deleted an empty folder in error, you can use the information in the report to replace it.
|As the last step in the operation, Empty Folder Track prompts you to view a report of the folders you deleted.|
Use a path instead
If you instruct Empty Folder Tracker to search the entire hard disk and find only a few empty folders you want to delete, you can make the procedure more efficient by canceling the delete operation and rerunning the utility using just a path as the search key. For example, if you search the entire hard disk and find empty folders you want to delete in C:\Program Files, you can use C:\Program Files as the search key.
Subsequent running of Empty Folder Tracker
When Empty Folder Tracker closes, it leaves its report files in the folder in which it was installed in case you want to refer to them later. If the report files exist the next time you launch Empty Folder Tracker, it will prompt you before overwriting them, as shown in Figure J.
|Before Empty Folder Tracker overwrites the report files, it will prompt you for confirmation.|
If you click No, Empty Folder Tracker lets you know that it is terminating so that you can rename or move the report files, as shown in Figure K.
|Empty Folder Tracker will terminate so that you can rename or move the report files.|
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.