Morbus Iff - 2003-12-16

Logged In: YES
user_id=69804

Here's that old code, sure to be slaughtered due to wordwraps:

# wipe out old backups. we keep, at most, five weeks worth.
# open the backup directory, get the files, and sort by name
(date).
opendir(DIR, $backup_files_to) or die "couldn't open backup dir:
$!";
my @files = grep /^[^\.]/, readdir(DIR); closedir(DIR); @files =
sort @files;

# get the total number of files. we use this to figure out how
# many files we want to delete by going that far into the array
# (if there are 20 files, then we need to delete the first 15).
my $total_files = scalar @files;
for (my $i = 0; $i < $total_files - 5; $i++) {
unlink "$backup_files_to$files[$i]";
print "Removing old backup files: $backup_files_to$files[$i]\n";
}