Windows Batch recursive delete old files

If your command interpreter is JP Software's TCC/LE, simply use date ranges and the del command. Here's how to delete files (and consequent empty directories) older than 30 days:

del /[d-30,%@makedate[0]] /s/x *
The * is a wildcard, of course, and can include a pathname.

Further reading

  • Jonathan de Boyne Pollard (2003,2007). Performing some commonly desired tasks with JP Software's command interpreters.. Frequently Given Answers.