--- a/purge-proe Mon May 17 13:47:47 2010 +0200
+++ b/purge-proe Mon May 17 13:51:24 2010 +0200
@@ -29,7 +29,7 @@
my $opt = {
dirs => [], # dont set default dir here because arguments to --directory will
- # not overwrite it, but added to it
+ # not overwrite it, but added to it
keep => 3,
recursive => 1
@@ -75,24 +75,17 @@
}
$opt->{dirs} = ['.'] unless @{$opt->{dirs}};
-#print join "\n", @{$opt->{dirs}};
-#exit;
find(\&doit, @{$opt->{dirs}});
my @sufs;
for my $stem (keys %{$files}) {
-#print "$stem $files->{$stem}\n";
@sufs = sort { $a <=> $b } @{$files->{$stem}};
-#for (@sufs) { print "$stem.$_\n"; }
-
my $to = $#sufs - $opt->{keep};
my $from;
if ($to < 0) { $from = 0; } else { $from = $to + 1; }
-#print "$from $#sufs\n";
-
for (@sufs[0 .. $to]) {
print "Going to delete $stem.$_\n";
warn "Couldn't unlink: $stem.$_: $!" unless unlink "$stem.$_";