FORFILES /P C:MyPath /S /M log*.xml /D -30 /C "cmd /c del @file"
/S – look at subdirectories
log*.xml – that is the file pattern, you could have it be like *.txt for example
/D -30 = files greater than 30 days
/C – thats the command you want to run
this is pretty much a one line command that could replace a ton of vbScripts, batch files, and other apps I have seen over the years to clean up files. Something for every sys admin’s toolbelt.