Help with clearing text file at month end - 25/11/18 07:59 AM
I don't no if this is possible. I keep monthly stats in my channel and need to clear the text file every month end. Any ideas?
ALIAS -l StatsFile return monthlystats- $+ $asctime(yyyy-mm) $+ .txt On *:Event: { write $StatsFile some statistic }
on *:LOAD: { if (!%currentmonth) { set %currentmonth $gettok($fulldate,2,32) } } on *:START: { .timer -o 0 3600 checkdate } alias checkdate { if (%currentmonth != $gettok($fulldate,2,32)) { set %currentmonth $gettok($fulldate,2,32) .remove chanstats.txt } }
;;/monthlyFile path/to/file alias monthlyFile { if ($asctime($file($1-).ctime, mm-yyyy) != $asctime(mm-yyyy)) { .remove $1- } }