As an system administrator I have a lot of log, bak and tmp files. In most situations I want to clean up the oldest files, but retaining te last log files.
So I made a script wich looks at the age and number of files to be retained.
Delete al files in TempDir with mask ~DF*.TMP minimum 24 hours old, but keeping 7 versions
_FileDeleteByAge(@TempDir, "~DF*.TMP", 24, 7)