I usually do most of my scripts using Kix, but in this case, you could also use the resource kit tool called 'forfiles'.

forfiles /p c:\temp /s /m *.log /d -30 /c "cmd /c echo @file"

/p = is the path to start searching
/s = do all subdirectories as well
/m = the file mask (*.bak, *.log, *.txt, etc)
/d = date calculation (-30 is 30 days ago, +30 is 30 days from today, -7 is 7 days ago, etc)
/c = command to execute (change echo @file to del @file to delete the files)
KiXing to the limits!