--- nfo/perl/scripts/archiver/bin/finder.pl 2003/02/01 01:38:35 1.1 +++ nfo/perl/scripts/archiver/bin/finder.pl 2003/02/01 06:41:21 1.3 @@ -1,9 +1,15 @@ #!/usr/bin/perl ## ------------------------------------------------------------------------ -## $Id: finder.pl,v 1.1 2003/02/01 01:38:35 joko Exp $ +## $Id: finder.pl,v 1.3 2003/02/01 06:41:21 joko Exp $ ## ------------------------------------------------------------------------ ## $Log: finder.pl,v $ +## Revision 1.3 2003/02/01 06:41:21 joko +## + added mechanism using option 'regex-exclude' +## +## Revision 1.2 2003/02/01 02:52:32 joko +## + minor update +## ## Revision 1.1 2003/02/01 01:38:35 joko ## + initial commit - partly refactored from replace_cvs.pl ## @@ -26,6 +32,11 @@ - finder.pl --regex=/CVS/Root$ /tmp/cvsroot finds all files/directories matching 'regex' in path '/tmp/cvsroot' and below (recursively) + - todo: + x exclude mechanism (use regex-exclude) + o remember all matched entries while processing, show at end of processing in report + o add some statistics (count-matched/count-all) + =cut @@ -35,27 +46,29 @@ BEGIN { use FindBin qw($Bin); #require "$Bin/use_libs.pl"; + #use org::netfrag::preambel; } use lib qw( ../../../libs ../libs ../etc ); -#use org::netfrag::preambel; use Data::Dumper; use File::Find; use Getopt::Easy; -# ---------------------------------------- -# main + # ---------------------------------------- package main; - my $settings; sub wanted { my $pattern = $settings->{options}->{regex}; + my $pattern_exclude = $settings->{options}->{'regex-exclude'}; #print "pattern: $pattern", "\n"; if ($File::Find::name =~ m/$pattern/) { + if ($pattern_exclude && $File::Find::name =~ m/$pattern_exclude/) { + return; + } print $File::Find::name, "\n"; #replaceInFile($File::Find::name); #exit;