Temp File Manager
Jeff Key
February 25, 2004
Charitable Donations

It seems like a lot of the little utils I write (both on this site and off) use temp files.  Writing temp files and cleanup code is just about the easist thing there is to do, which is why it's such a hassle to have to keep doing it over and over.  This class creates a temp folder for your temp files, gives you unique filenames in that folder, then cleans up those files.  It even has an evil finalizer so you don't need to explicitly tell it to clean up for itself, although it would be kind of you to do so.

Source