48 lines
1.3 KiB
Perl
Executable File
48 lines
1.3 KiB
Perl
Executable File
#!/usr/local/bin/perl
|
|
|
|
use strict;
|
|
use lib '/var/home/slowtwitch/slowtwitch.com/cgi-bin/articles/admin';
|
|
use Links qw/:objects/;
|
|
|
|
$| = 1;
|
|
local $SIG{__DIE__} = \&Links::fatal;
|
|
Links::init('/var/home/slowtwitch/slowtwitch.com/cgi-bin/articles/admin');
|
|
Links::init_admin();
|
|
|
|
use File::stat;
|
|
|
|
sub do_this {
|
|
my ($dir) = shift;
|
|
if (opendir DIR, $dir) { # it's a directory
|
|
for my $entry (sort readdir DIR) {
|
|
next if $entry eq "." or $entry eq "..";
|
|
next if $entry =~ /New\//;
|
|
next if $dir =~ /New\//;
|
|
next if $entry =~ /images/;
|
|
next if -l "$dir/$entry";
|
|
do_this("$dir/$entry"); # recurse
|
|
}
|
|
}
|
|
else { # it's a file
|
|
if ($dir =~ /_(\d+)\.html$/ and $dir !~ m,/New/, and $dir =~ m,www\/[A-Z],) {
|
|
my $sb = stat($dir);
|
|
my $time = time - 24*60*60;
|
|
if ($sb->mtime < $time) {
|
|
print $dir . ": ";
|
|
print scalar localtime $sb->mtime;
|
|
if (-f $dir) {
|
|
unlink $dir;
|
|
}
|
|
print " ($time)\n";
|
|
}
|
|
|
|
#printf "File is %s, size is %s, perm %04o, mtime %s\n", $dir, $sb->size, $sb->mode & 07777, scalar localtime $sb->mtime;
|
|
}
|
|
}
|
|
}
|
|
|
|
do_this($CFG->{build_root_path}); # our top-level directory
|
|
|
|
|
|
|