Automating a flatfile maintenance routine
Posted: Mon May 18, 2009 8:43 am
Hello Folks,
For some while now I've been very successfully using the kloth.net
bad robots trap. It uses a flatfile reference called blacklist.dat.
Every couple of months I manually trim this file, usually when it has
grown to around 200 lines or more. I take out the first 50 entries,
then save the file. Is there a way of automating this procedure?
The blacklist.dat file is written to by activation of the trap, so what
I'd like to be able to do is...
test whether there are 200 entries
if so, read in the file starting at line 50
then save the trimmed file.
I'm reasonably OK with PHP to generate HTML content, but a complete
duffer when it comes to file handling. Any help you give will be be very
gratefully received. Thanks in advance.
For some while now I've been very successfully using the kloth.net
bad robots trap. It uses a flatfile reference called blacklist.dat.
Every couple of months I manually trim this file, usually when it has
grown to around 200 lines or more. I take out the first 50 entries,
then save the file. Is there a way of automating this procedure?
The blacklist.dat file is written to by activation of the trap, so what
I'd like to be able to do is...
test whether there are 200 entries
if so, read in the file starting at line 50
then save the trimmed file.
I'm reasonably OK with PHP to generate HTML content, but a complete
duffer when it comes to file handling. Any help you give will be be very
gratefully received. Thanks in advance.