I would like to write a batch file in order to delete some backup files and directories according to their age. The directories change names every day with the date appended to the name. The batch file would be run by Comodo Backup after the backup is completed. If someone could help me out in this I would appreciate it. I use XP Home 32bit.
@echo off
echo wscript.echo date-1>tmp.vbs
for /f %%a in (‘cscript tmp.vbs //Nologo’) do set “yesterday=%%a”
for /f “tokens=1-3 delims=/” %%a in (“%yesterday%”) do (
set “mm=%%a”
set “dd=%%b”
set “yy=%%c”
)
if “%mm:~1,1%”==“” set mm=0%mm%
if “%dd:~1,1%”==“” set dd=0%dd%
echo %mm%%dd%%yy:~-2%& DEL tmp.vbs
this batch file generates %yesterday% in MMDDYY format. if %today% is 022009, this batch outputs 021909. it can be easily modified to kick out any previous date that you want.