Free Up Space by Deleting Backup Hotfix Folders

Here's a script that you can use to delete all the backup hotfix folders and associated log files in C:\WINDOWS (Windows 2003) or C:\WINNT (Windows 2000).

Readers

May 29, 2007

1 Min Read
ITPro Today logo


The field servers in our companyare several years old, and newapplications are taking up a lot ofspace on the C drive. To free upsome space, I wrote a script, DeleteHotfixBackups.bat, that deletes allthe backup folders for Microsofthotfixes and the associated log filesin C:WINDOWS.

Listing 1 shows DeleteHotfixBackups.bat. Microsoft's backup hotfix folders are hidden folders that start with the $ character. So, in a For loop, the script uses the Dir command to obtain the names of all the hidden folders that begin with the $ character. The script pipes the names to the Do portion of the loop, where the RD command deletes those folders.

To use DeleteHotfixBackups.bat, you simply need to place the script on your server and run it. I wrote this script for Windows Server 2003 and Windows 2000. Note that deleting all the backup hotfix folders can be risky if a hotfix breaks an application and you need to undo that particular hotfix. This script will also remove any backup service-pack folders because they also begin with the $ character.
—Tom Barnett, senior IT analyst, Fortune 250 energy company

See Associated Figure

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like