On Tue, 18 Nov 1997, Chris Jacobson wrote:
> I use a Perl script by Patrick Dughi for cleaning out ASCII pfiles... all
> it does right now is check for the Deleted flag. However, I was
> wondering if it was possible to add in a check for Levl: # being less
> than a certain number, and the file being older than, say, 30 days.
>
> Is this possible? If so, anyone care to give me a small snippet of code?
> I know no Perl :-)
way up top, add
$LEVEL_DEL=10; # level to delete after 30 days.
Add this in find_and_remove after
if (/Id /) {
($id,$colon,$idnum)=split(/\s+/,$_,3);
chop($idnum);
}
add these lines:
if (/Last/) {
($last,$colon,$lastnum)=split(/\s/,$_,3);
chop($lastnum);
}
if (/Levl/) {
($levl,$colon,$levlnum)=split(/\s/,$_,3);
chop($lastnum);
}
and then, right before the close(PFILE) line, add
/* check for level being less than a certain number, and the character not
having logged in for about a month */
if ((time() - $lastnum) > (60*60*24*30)) && ($levlnum < $LEVEL_DIR)) {
#then, its more than a month
$delete=1;
}
Huzzzah. It is done.
PjD
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST