Remove out date logs

hi all,

i would like to write the shell script to remove the out-dated log
my log file name will be like this:
access_20050101.log
access_20050102.log
.
.
.
access_20071007.log
access_20071008.log
access_20071009.log

i has try to write the command as following, it will be remove the log if older then 90 days,
but if someone has modified the log, the file timestamp will be updated
so how can i remove the log base on the file name?

find /usr/local/apache2/logs -type f -mtime +90 -exec rm -f {} \;

Ideally things like webserver logs shouldn't be updated manually. Also, if you are planning to make this a regular script, it will work fine with the find using +90. If you are looking to just do a one time cleanup, just manually remove files from, say, 2005 and 2006 using 'rm /usr/local/apache2/logs/access_2005*' and 'rm /usr/local/apache2/logs/access_2006*'

blowtorch suggestion is better way...

If you really want to do that, you can try to get the yearmonth from the file and get current yearmonth to minus it, if result >= 4, then rm...

eg.
for file in `ll |grep access|awk '{print $9}'`;do
fdate=`echo $file | cut -c 8-13`;
cdate=`date +%Y%m`
dnum=`expr $cdate - $fdate`
if [ $dnum -ge 4 ]; then
rm $file
fi
done