KeepNewest is a free Win32 (not tried it in DOS yet) command line utility that removes old files, and leaves only the latest few files. You the number of files to leave in every subfolder. This is ideal for automatically deleting old backup files.
I backup my web site daily to an ftp windows server, but the backup folder soon gets too large, so I also run KeepNewest once a day to delete all but the last 3 backups from the folder.
C:\>keepnewest KeepNewest V0.8.0.0 - Deletes older files from a directory. (C) Copyright 2006 Andrew Joiner - www.tekkies.co.uk/go/keepnewest This program is free, use it entirely at your own risk. Please consider donating to www.meal-a-day.org Usage: KeepNewest [-y] [-v] <"filespec"> -y Skip confirmation message. -v Verbose messages. -s Recurse subdirectories. e.g. Delete all but the latest 5 .tmp files from temp folder (and does to same to any subfolder): KeepNewest -y 5 "c:\temp\*.tmp"