X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=last.pl;h=602473901f71f49dfa106ddbef2c63eada94a441;hb=c45d2eb055b006b20ae280d34aee8f871b79d456;hp=99ee2f5ac082cec37afc8165e99f241e93063d59;hpb=07ea12f5301c50d4c6595be5cba8544658ddc7f6;p=webpdf diff --git a/last.pl b/last.pl index 99ee2f5..6024739 100755 --- a/last.pl +++ b/last.pl @@ -14,6 +14,18 @@ if ($real_show_last > $pdfweb::config::show_last) { $real_show_last = $pdfweb::config::show_last; } +# This is probably the simplest place to clean up files that we no longer +# need having around. +for my $t (@thumbnails[$pdfweb::config::show_last..$#thumbnails]) { + if (-M $t > $pdfweb::config::minimum_age) { + (my $base = $t) =~ s/\.png$//; + my @to_delete = <$base*>; + + warn "Deleting " . join(', ', @to_delete); + unlink @to_delete; + } +} + # Sorry, no HTML templating. I didn't want to pull in yet another # dependency :-)