I have also done a general program with an ini file thats control this kind of function.
The ini file looks like this:
Code:
 # Day = Number of days from todays date that files should be kept. Day = 0 means that all file will be removed.
# Path = The path where the script should look in.
[Parameter]
Day=3
Path=C:\SomePath



Here is the kix code, I use a function called FlipcTime() I found in someones kix library.
Code:

$IniFile = ".\DelFile.ini"
$LogFile = ".\DelFile.log"

$rc = RedirectOutput( "$LogFile" ,1 )
? "Start " + @Date + " " + @Time

$OneDaySec = 86400
$TodayVal = FlipcTime(@DATE,"00:00")

If Exist( $IniFile )
$Day = ReadProfileString("$IniFile","Parameter","Day")
$Path = Trim( ReadProfileString("$IniFile","Parameter","Path") )
Else
? "Cant find $IniFile"
Exit
EndIf

$DelValue = $TodayVal - $OneDaySec * $Day
$FileName = Dir( $Path )
While $FileName <> "" And @ERROR = 0
$File = "$Path" + "\" + "$FileName"
$FiAt = GetFileAttr( "$File" )
If $FiAt = 1 Or $FiAt = 2 Or $FiAt = 3 Or $FiAt = 32 Or $FiAt = 33 Or $FiAt = 34 Or $FiAt = 35 Or $FiAt = 128 ; Fil och ej Dir
$FileDate = SubStr( GetFileTime( "$File" ) ,1,10)
$FileVal = FlipcTime( $FileDate,"00:00" )
If $FileVal <= $DelValue
Del "$File" /f /h
? "remove file $File " + " / $FileDate with errorcode @Error"
EndIf
EndIf
$FileName = Dir() ; retrieve next file
Loop

Exit

Function FlipcTime($date,$time,optional $tz)
Dim $y,$m,$d
$date = Split($date,"/")
If Ubound($date) <> 2 Exit(1) EndIf
$y=Val($date[0]) $m=Val($date[1]) $d=Val($date[2])
If $m<3
$m=$m+12
$y=$y-1
EndIf
$Date=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306
$time = Split($time,":")
Select
Case Ubound($time)=1
ReDim preserve $time[2]
$time[2]=0
Case Ubound($time)=2
Case 1
Exit(1)
EndSelect
$time = (Val($time[0])*3600)+(Val($time[1])*60)+Val($time[2])
$flipctime = IIf($tz,(($date-719163)*86400 + $time)-($tz*3600),($date-719163)*86400 + $time)
EndFunction



I then schedule this and I have this running on several servers to remove logs from several programs.
Works perfect.

Mima