Click here to Skip to main content
12,292,006 members (73,008 online)
Click here to Skip to main content
Add your own
alternative version


95 bookmarked

A Utility to Clean Up Compiler Temp Files

, 24 Dec 2002
Rate this:
Please Sign up or sign in to vote.
A shell extension that deletes compiler temp and intermediate files.

 [DirClean menu items - 9K]

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:

 [DirClean options - 9K]

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 "*.*" Wink | ;) 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.


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


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Michael Dunn
Software Developer (Senior) VMware
United States 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...

Comments and Discussions

GeneralRe: VisStudio.Net problem Pin
thanhthuyvn_vtajkhskjakjd9-Apr-07 22:27
memberthanhthuyvn_vtajkhskjakjd9-Apr-07 22:27 
GeneralThank you Pin
Jiří Šoler2-Jan-03 22:04
sussJiří Šoler2-Jan-03 22:04 
GeneralSuggestion Pin
rrrado2-Jan-03 7:21
memberrrrado2-Jan-03 7:21 
Questioncleanex? Pin
bryce30-Dec-02 22:36
memberbryce30-Dec-02 22:36 
AnswerRe: cleanex? Pin
Blake Miller31-Dec-02 5:05
memberBlake Miller31-Dec-02 5:05 
GeneralRe: cleanex? Pin
bryce31-Dec-02 20:23
memberbryce31-Dec-02 20:23 
GeneralI always used Explorers Find Files Pin
Daniel Lohmann30-Dec-02 4:45
memberDaniel Lohmann30-Dec-02 4:45 
GeneralRe: I always used Explorers Find Files Pin
min_zon30-Dec-02 15:13
membermin_zon30-Dec-02 15:13 
GeneralRe: I always used Explorers Find Files Pin
Daniel Lohmann31-Dec-02 4:18
memberDaniel Lohmann31-Dec-02 4:18 
GeneralPlease document Win95TruncatedExtensions Pin
Tom Welch18-Dec-02 5:07
memberTom Welch18-Dec-02 5:07 
GeneralRe: Please document Win95TruncatedExtensions Pin
Michael Dunn20-Dec-02 6:04
sitebuilderMichael Dunn20-Dec-02 6:04 
GeneralRe: Please document Win95TruncatedExtensions Pin
Tom Welch20-Dec-02 9:33
memberTom Welch20-Dec-02 9:33 
GeneralWhat's a f*! Pin
AirMax12-Dec-02 14:19
memberAirMax12-Dec-02 14:19 
I repeat, what's a f$#k!

I got Windows 2000 and it's cmd.exe wildcards parsing sucks just as it was in W95!Mad | :mad:

Suppose we have files, qqq.rer, qqq.rerere in one directory

"dir *.re" lists
"dir *.rer" lists qqq.rer AND qqq.rerere Eek! | :eek:

And, of course, "del *.re" deletes only one file and "del *.rer" deletes BOTH files! Dead | X|

That's sucks!

Explorer's search does not suck such bad.

Why does this sh***y Windows acts such buggy like this and user could never knew about, if only accidentally stuck to a message like one in thread below.

I mean, somebody below had said it "was in W95, do some undocumented registry f$#king to disable this"... ain't we have year 2002 by now? ain't we have Whistler and upcoming Longhorg? What's the f#$k!

That is what is called "backward comBUGability"!Laugh | :laugh:

Another question, to the author of this "excellent" tool...

If explorer' file search dialog treats wildcards "OK", and good old command prompt treats wildcards "SUCK", How did you managed to write "SUCK" application by using "OK" API?!!!Confused | :confused:

angry windows programmer
GeneralRe: What's a f*! Pin
Reinout Hillmann25-Dec-02 22:23
memberReinout Hillmann25-Dec-02 22:23 
GeneralAnother utility Pin
Bil Simser7-Dec-02 15:04
memberBil Simser7-Dec-02 15:04 
GeneralProblems :( Pin
Selevercin9-Nov-02 12:09
memberSelevercin9-Nov-02 12:09 
GeneralRe: Problems :( Pin
Michael Dunn9-Nov-02 12:21
sitebuilderMichael Dunn9-Nov-02 12:21 
GeneralNice tool but... Pin
miliu8-Oct-02 4:34
sussmiliu8-Oct-02 4:34 
Question*.res == *.resx ??? Pin
Odissey4-Oct-02 2:56
memberOdissey4-Oct-02 2:56 
AnswerRe: *.res == *.resx ??? Pin
Andreas Saurwein4-Oct-02 4:09
memberAndreas Saurwein4-Oct-02 4:09 
GeneralRe: *.res == *.resx ??? Pin
Anonymous24-Dec-02 1:45
sussAnonymous24-Dec-02 1:45 
GeneralRe: *.res == *.resx ??? Pin
Andreas Saurwein25-Dec-02 7:53
memberAndreas Saurwein25-Dec-02 7:53 
GeneralMy Project Dir Pin
Anonymous27-Jul-02 9:48
sussAnonymous27-Jul-02 9:48 
GeneralPlease add subfolders Pin
Anonymous31-Oct-01 12:41
memberAnonymous31-Oct-01 12:41 
GeneralRe: Please add subfolders Pin
Coder2-Nov-01 2:27
memberCoder2-Nov-01 2:27 
GeneralRe: Please add subfolders Pin
Anonymous16-Oct-02 5:45
sussAnonymous16-Oct-02 5:45 
GeneralRe: Please add subfolders Pin
Michael Dunn2-Nov-01 8:30
memberMichael Dunn2-Nov-01 8:30 
GeneralTHANK YOU! Pin
Greven31-Oct-01 6:04
memberGreven31-Oct-01 6:04 
GeneralWe dont need a utility to do that! Pin
Anonymous29-Oct-01 5:21
memberAnonymous29-Oct-01 5:21 
GeneralRe: We dont need a utility to do that! Pin
William E. Kempf29-Oct-01 11:30
memberWilliam E. Kempf29-Oct-01 11:30 
GeneralRe: We dont need a utility to do that! Pin
Anonymous29-Oct-01 14:40
memberAnonymous29-Oct-01 14:40 
GeneralRe: We dont need a utility to do that! Pin
Sardaukar30-Oct-01 5:47
memberSardaukar30-Oct-01 5:47 
QuestionUnregister / uninstall - how? Pin
markuea14-Oct-01 6:45
membermarkuea14-Oct-01 6:45 
AnswerRe: Unregister / uninstall - how? Pin
Michael Dunn14-Oct-01 8:23
memberMichael Dunn14-Oct-01 8:23 
QuestionErr.. how to register the dll? Pin
Robin1-Aug-00 23:06
sussRobin1-Aug-00 23:06 
AnswerRe: Err.. how to register the dll? Pin
Mike Dunn2-Aug-00 6:51
sussMike Dunn2-Aug-00 6:51 
QuestionHow to Add Separators or Submenus to ... Pin
David L.9-Jun-00 21:14
sussDavid L.9-Jun-00 21:14 
AnswerRe: How to Add Separators or Submenus to ... Pin
Mike Dunn2-Jul-00 17:03
sussMike Dunn2-Jul-00 17:03 
GeneralMFCClean - Why is great Pin
Leon6-Jun-00 17:03
sussLeon6-Jun-00 17:03 
GeneralBUGFIX: Not registering on NT/2K Pin
Mike Dunn5-Jun-00 20:09
sussMike Dunn5-Jun-00 20:09 
Generalfiles with similar extensions Pin
Juan José Rodríguez5-Mar-00 17:03
sussJuan José Rodríguez5-Mar-00 17:03 
GeneralRe: files with similar extensions Pin
Mike Dunn5-Mar-00 19:07
sussMike Dunn5-Mar-00 19:07 
GeneralRe: files with similar extensions Pin
Matthew Ellis6-Mar-00 2:42
sussMatthew Ellis6-Mar-00 2:42 
GeneralRe: files with similar extensions Pin
Alvaro Mendez9-Jun-00 8:32
sussAlvaro Mendez9-Jun-00 8:32 
GeneralRe: files with similar extensions Pin
Uniwares12-Jul-01 3:22
memberUniwares12-Jul-01 3:22 
GeneralRe: files with similar extensions Pin
Andreas Saurwein16-Jul-01 21:37
memberAndreas Saurwein16-Jul-01 21:37 
GeneralRe: files with similar extensions Pin
Sardaukar30-Oct-01 5:45
memberSardaukar30-Oct-01 5:45 
GeneralNo source for the DLL Pin
Michael Walz4-Mar-00 0:59
sussMichael Walz4-Mar-00 0:59 
GeneralPardon? Pin
Mike Dunn4-Mar-00 11:29
sussMike Dunn4-Mar-00 11:29 
Generalsimilar program Pin
Darren Schroeder2-Mar-00 7:30
sussDarren Schroeder2-Mar-00 7:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160518.1 | Last Updated 25 Dec 2002
Article Copyright 2000 by Michael Dunn
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid