if you are using date formulas as part of the log name you
can do something like the following (treak it to your
needs). I kind of shortened it a bit just to give you
some ideas. try
www.labmice.net for more info on
scripting or Rob VanWonderworld (think that's the name of
the guy/site). If you search for Windows Batch file
commands you'll hit a ton of sites. You can also use the
same formula (basically) as extracting the date to parse
the date/time from the filestamp if you aren't using dates
in the log file naming convention. I'd say you definitely
don't need to pay for anything....maybe a couple hours of
time to do the research
========================
@echo off
REM ***********************
REM Created by James Shaver
REM (e-mail address removed)
REM Revision 1: Oct 6, 2003
REM ***********************
REM ***********************
REM Set Date variables
REM ***********************
for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (
set DayOfWeek=%%i
set Month=%%j
set Day=%%k
set Year=%%l
)
REM ***********************
REM subtract 4 days to know date of backup file to delete
REM ***********************
set Lday=%Day%
set /A Lday -= 4
set zero = 0
REM ***********************
REM If day is single integer and 4 or less go to previous
month for month variable
REM ***********************
if %Day%=01 GOTO Mday
if %Day%=02 Goto Mday
if %Day%=03 Goto Mday
if %Day%=04 Goto Mday
REM ***********************
REM if date of backup to delete day is 5 or greater stay
in same month
REM ***********************
if %Day%=05 Goto Backo
if %Day%=06 Goto Backo
if %Day%=07 Goto Backo
if %Day%=08 Goto Backo
if %Day%=09 Goto Backo
goto Backp
:Mday
if %Month%=01 Goto :Jan
if %Month%=02 Goto :Feb
if %Month%=03 Goto :Mar
if %Month%=04 Goto :Apr
if %Month%=05 Goto :May
if %Month%=06 Goto :Jun
if %Month%=07 Goto :Jul
if %Month%=08 Goto :Aug
if %Month%=09 Goto :Sep
if %Month%=10 Goto :Oct
if %Month%=11 Goto :Nov
if %Month%=12 Goto

ec
:Jan
set /A Lday += 31
set Month =12
Goto Backp
:Feb
set /A Lday += 31
set Month = 01
Goto Backp
REM ***********************
REM Check for leap year
REM ***********************
:Mar
if %Year% = 2004 set /A Lday += 29
if %Year% = 2008 set /A Lday += 29
if %Year% = 2012 set /A Lday += 29
if %Year% = 2016 set /A Lday += 29
else set /A Lday += 28
set Month = 02
Goto Backp
:Apr
set /A Lday += 31
set Month = 03
Goto Backp
:May
set /A Lday += 30
set Month = 04
Goto Backp
:Jun
set /A Lday += 31
set Month = 05
Goto Backp
:Jul
set /A Lday += 30
set Month = 06
Goto Backp
:Aug
set /A Lday += 31
set Month = 07
Goto Backp
:Sep
set /A Lday += 31
set Month = 08
Goto Backp
:Oct
set /A Lday += 30
set Month = 09
Goto Backp
:Nov
set /A Lday += 31
set Month = 10
Goto Backp

ec
set /A Lday += 30
set Month = 11
Goto Backp
REM ***********************
REM Use current day variable to copy current file and use
Lday variable to delete log from 4 days ago
REM ***********************
:Backp
del e:\logfile_db-%Year%%Month%%Lday%_01_03_11
Goto End
REM ***********************
REM Use current day variable to copy current file and use
Lday variable to delete log from 4 days ago
REM Since Lday is single digit also use Zero variable to
add the place holder
REM ***********************
:Backo
del e:\logfile_db-%Year%%Month%%Zero%%Lday%_01_03_11
:End
exit