Deleting old files on Windows
I ran into a situation today where I wanted to script deletion of folders older than a set number days on an old Windows 2000 machine. (The culprit is a commercial SMTP spam and virus filter that does not clean up after itself when it updates. Eventually the drive gets full and no mail comes through.) I found a solution using forfiles but this version of Windows does not have it. I found myself searching the web and gnashing my teeth over the limitations of Windows batch scripting.
if (WScript.arguments.length != 2)
As a nice bonus, the Folder.Delete method works recursively, even on non-empty directories. You invoke the script using the Windows Script Host, cscript.exe:
C:\>cscript //Nologo delete-folders.js C:\dir\to\clean\up 2
Some breadcrumbs if you are looking for the documentation: