Cleaning work files on Windows

Found an interesting paper by John M. Wildenthal of JPMorgan Chase called An Effective CLEANWORK.SASĀ® for Windows , outlining a way of automatically deleting work files for any SAS processes that have been terminated abnormally.

Abstract of the paper is:

SAS provides an effective utility for deleting orphaned work directories on Unix boxes. But their offering for Windows
merely deletes everything older than a particular time (http://support.sas.com/techsup/unotes/SN/008/008786.html).

This is unworkable for a server environment. This paper discusses a short program for Windows that parses the root
WORK directory and matches directory names to SAS v9 running processes. Directories that are not matched are
then deleted.