# HG changeset patch # User Matthias Förste # Date 1274097084 -7200 # Node ID 86d4e8e2668e958266b80c24a5a37ae01dee30a8 # Parent fcdba28f4b068283280c8963d99cdd861bfe9642 cosmetics diff -r fcdba28f4b06 -r 86d4e8e2668e purge-proe --- 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.$_";