version 1.10, 2005/04/06 23:40:20 |
version 1.12, 2005/05/02 21:27:00 |
|
|
|
|
justme(); |
justme(); |
|
|
|
my $Name_Filter = shift || ''; |
|
if ($Name_Filter =~ /^(\w*)$/) { |
|
$Name_Filter = $1; |
|
} else { |
|
die "Invalid filter: $Name_Filter"; |
|
} |
|
|
my %files; |
my %files; |
opendir DIR, $OBT->{DIR_TORRENT} |
opendir DIR, $OBT->{DIR_TORRENT} |
or die "Couldn't opendir $OBT->{DIR_TORRENT}: $!"; |
or die "Couldn't opendir $OBT->{DIR_TORRENT}: $!"; |
|
|
my %keep; |
my %keep; |
my @delete; |
my @delete; |
foreach my $name (keys %files) { |
foreach my $name (keys %files) { |
#print "$name\n"; |
next unless $name =~ /^$Name_Filter/; |
|
print "Checking $name\n"; |
|
|
foreach my $epoch ( sort { $b <=> $a } keys %{ $files{$name} } ) { |
foreach my $epoch ( sort { $b <=> $a } keys %{ $files{$name} } ) { |
#print "\t$epoch\n"; |
#print "\t$epoch\n"; |
|
|
|
|
foreach (@delete) { |
foreach (@delete) { |
print "Deleting '$_'\n"; |
print "Deleting '$_'\n"; |
unlink $OBT->{TORRENTDIR} . "/$_" or die "Couldn't unlink $_"; |
unlink $OBT->{DIR_TORRENT} . "/$_" or die "Couldn't unlink $_"; |
} |
} |