Go to top

# A Utility to Clean Up Compiler Temp Files

, 24 Dec 2002
 Rate this:
A shell extension that deletes compiler temp and intermediate files.

Recently at work, I was talking with a coworker about cool little utilities that we wished we had. He mentioned an idea for a shell extension that would remove all intermediate compiler files (such as *.obj) from a directory (and recurse subdirectories, naturally). That sounded pretty neat, and since he was in the middle of writing up a different cool program, I decided to get cracking on the clean-up utility and see what I could do.

I came up with this little app, DirClean. It's a shell extension that appears on the context menu of directories, and has a "Clean up temp files" command that will remove intermediate compiler files from the selected directory and its subdirectories. By default, the files are put in the Recycle Bin, but you can configure DirClean to just delete the files instead. DirClean uses the SHFileOperation function to delete files, so if there are a lot of files to delete, you'll see the familiar flying-paper progress dialog.

DirClean has both ANSI and Unicode versions. It was written with VC 6 SP 3, and tested on Win 98 and Win 2000.

The "DirClean options" menu item brings up the DirClean options dialog:

The settings here should be self-explanatory. I don't do any checking of the wildcards you enter, so you probably don't want to enter "*.*" The settings are saved in HKEY_CURRENT_USER, so each user has his own settings.

Note that you can override the "Send files to the Recycle Bin" setting by holding down the Shift key when clicking "Clean up temp files." Holding in Shift will immediately delete files if you have the option set to send files to the Recycle Bin, and vice versa.

Important note for VS.NET users

On the NT-based OSes, the way that the shell handles extensions of more than 3 characters will cause problems for C# projects. The default behavior of the shell makes the wildcard *.res match .RESX files (it only compares the first three characters), and deleting the .RESX files will delete some resource information.

So, to avoid deleting those files, you can either remove *.res from the list of files to delete, or go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem, and set the DWORD value Win95TruncatedExtensions to 0, then restart your computer. See KB article Q164351 for more info on this feature.

## History

Oct 28, 2001 - Default list of wildcards updated.
Dec 25, 2002 - Added note about the Win95TruncatedExtensions registry entry.

A list of licenses authors might use can be found here

## Share

Software Developer (Senior) VMware
United States
Michael lives in sunny Mountain View, California. He started programming with an Apple //e in 4th grade, graduated from UCLA with a math degree in 1994, and immediately landed a job as a QA engineer at Symantec, working on the Norton AntiVirus team. He pretty much taught himself Windows and MFC programming, and in 1999 he designed and coded a new interface for Norton AntiVirus 2000.
Mike has been a a developer at Napster and at his own lil' startup, Zabersoft, a development company he co-founded with offices in Los Angeles and Odense, Denmark. Mike is now a senior engineer at VMware.

He also enjoys his hobbies of playing pinball, bike riding, photography, and Domion on Friday nights (current favorite combo: Village + double Pirate Ship). He would get his own snooker table too if they weren't so darn big! He is also sad that he's forgotten the languages he's studied: French, Mandarin Chinese, and Japanese.

Mike was a VC MVP from 2005 to 2009.

## You may also be interested in...

### Why “Good Enough” Isn’t Good Enough Anymore for Software Configuration Management

 We dont need a utility to do that! Anonymous 29-Oct-01 5:21
 Re: We dont need a utility to do that! William E. Kempf 29-Oct-01 11:30
 Re: We dont need a utility to do that! Anonymous 29-Oct-01 14:40
 Re: We dont need a utility to do that! Sardaukar 30-Oct-01 5:47
 Unregister / uninstall - how? markuea 14-Oct-01 6:45
 Re: Unregister / uninstall - how? Michael Dunn 14-Oct-01 8:23
 Err.. how to register the dll? Robin 1-Aug-00 23:06
 Re: Err.. how to register the dll? Mike Dunn 2-Aug-00 6:51
 From a command prompt, run:   C:\windows\system\regsvr32 C:\path\to\dirclean.dll   (Change system to system32 on NT and 2000.
 How to Add Separators or Submenus to ... David L. 9-Jun-00 21:14
 Re: How to Add Separators or Submenus to ... Mike Dunn 2-Jul-00 17:03
 MFCClean - Why Codeproject.com is great Leon 6-Jun-00 17:03
 BUGFIX: Not registering on NT/2K Mike Dunn 5-Jun-00 20:09
 files with similar extensions Juan José Rodríguez 5-Mar-00 17:03
 Re: files with similar extensions Mike Dunn 5-Mar-00 19:07
 Re: files with similar extensions Matthew Ellis 6-Mar-00 2:42
 Re: files with similar extensions Alvaro Mendez 9-Jun-00 8:32
 Re: files with similar extensions Uniwares 12-Jul-01 3:22
 Re: files with similar extensions Andreas Saurwein 16-Jul-01 21:37
 Re: files with similar extensions Sardaukar 30-Oct-01 5:45
 No source for the DLL Michael Walz 4-Mar-00 0:59
 Pardon? Mike Dunn 4-Mar-00 11:29
 similar program Darren Schroeder 2-Mar-00 7:30
 Re: similar program Chris Maunder 2-Mar-00 15:48
 Re: similar program Mike Dunn 2-Mar-00 18:04
 Re: similar program Todd Wilson 9-Jun-00 5:18
 Last Visit: 31-Dec-99 18:00     Last Update: 19-Sep-14 18:33 Refresh « Prev1234 Next »