I think the easiest way would be to use
forfiles.
set agefactor=7
forfiles /p d:\SQL-Backup /s /d -%agefactor% /m *.rar ^
/c "cmd /c echo @PATH older than %agefactor% days"
I prefer not to write destructive code, so as written the snippet will just list the files. You can change the
echo command to a
del command once you are satisfied with the results. Also change the value of
agefactor in the first line as needed. Note: Enter the
agefactor as a positive number, it will be converted to a negative number in the code.
Good luck