cleaner
changeset 6 129b39480dc5
parent 4 fb2455a007a7
child 7 a508df65c738
--- a/cleaner	Sun Jul 24 00:22:11 2011 +0200
+++ b/cleaner	Sun Jul 24 00:51:36 2011 +0200
@@ -21,6 +21,7 @@
 ); lock_keys(%o);
 
 MAIN: {
+    Getopt::Long::Configure qw(Bundling);
     GetOptions(
 	"n|dry!" => \$o{dry},
 	"v|verbose!" => \$o{verbose},
@@ -40,7 +41,7 @@
 
     find(sub {
 	(-f) and (-M > 0) or return;
-	verbose("idx: $File::Find::name");
+	#verbose("idx: $File::Find::name");
 	push @idx, abs_path $_;
 	foreach my $f (get_file_list($_)) {
 	    push @{$inuse{$f}} => $#idx;
@@ -91,17 +92,16 @@
 
 	# cut away the first part of the filename and
 	# some optional extension
-	$File::Find::name = abs_path $File::Find::name;
 	(my $rn = $File::Find::name) =~ s/^$dir\/data\/(.*?)(?:\..+)?$/$1/;
 	exists $inuse{$rn} and return;
 
 	if ($o{dry}) {
-	    verbose("(unlinking) $File::Find::name");
+	    verbose("(unlinking) abs_path $File::Find::name");
 	    return;
 	}
 
-	verbose("unlinking $File::Find::name");
-	unlink $File::Find::name;
+	verbose("unlinking abs_path $File::Find::name");
+	unlink abs_path $File::Find::name;
 
     }, "$dir/data");