| 4 |
## $Id$ |
## $Id$ |
| 5 |
## ------------------------------------------------------------------------ |
## ------------------------------------------------------------------------ |
| 6 |
## $Log$ |
## $Log$ |
| 7 |
|
## Revision 1.3 2003/02/01 06:41:21 joko |
| 8 |
|
## + added mechanism using option 'regex-exclude' |
| 9 |
|
## |
| 10 |
|
## Revision 1.2 2003/02/01 02:52:32 joko |
| 11 |
|
## + minor update |
| 12 |
|
## |
| 13 |
## Revision 1.1 2003/02/01 01:38:35 joko |
## Revision 1.1 2003/02/01 01:38:35 joko |
| 14 |
## + initial commit - partly refactored from replace_cvs.pl |
## + initial commit - partly refactored from replace_cvs.pl |
| 15 |
## |
## |
| 32 |
- finder.pl --regex=/CVS/Root$ /tmp/cvsroot |
- finder.pl --regex=/CVS/Root$ /tmp/cvsroot |
| 33 |
finds all files/directories matching 'regex' in path '/tmp/cvsroot' and below (recursively) |
finds all files/directories matching 'regex' in path '/tmp/cvsroot' and below (recursively) |
| 34 |
|
|
| 35 |
|
- todo: |
| 36 |
|
x exclude mechanism (use regex-exclude) |
| 37 |
|
o remember all matched entries while processing, show at end of processing in report |
| 38 |
|
o add some statistics (count-matched/count-all) |
| 39 |
|
|
| 40 |
=cut |
=cut |
| 41 |
|
|
| 42 |
|
|
| 46 |
BEGIN { |
BEGIN { |
| 47 |
use FindBin qw($Bin); |
use FindBin qw($Bin); |
| 48 |
#require "$Bin/use_libs.pl"; |
#require "$Bin/use_libs.pl"; |
| 49 |
|
#use org::netfrag::preambel; |
| 50 |
} |
} |
| 51 |
|
|
| 52 |
use lib qw( ../../../libs ../libs ../etc ); |
use lib qw( ../../../libs ../libs ../etc ); |
|
#use org::netfrag::preambel; |
|
| 53 |
|
|
| 54 |
use Data::Dumper; |
use Data::Dumper; |
| 55 |
use File::Find; |
use File::Find; |
| 56 |
use Getopt::Easy; |
use Getopt::Easy; |
| 57 |
|
|
| 58 |
# ---------------------------------------- |
|
|
# main |
|
| 59 |
# ---------------------------------------- |
# ---------------------------------------- |
| 60 |
package main; |
package main; |
| 61 |
|
|
|
|
|
| 62 |
my $settings; |
my $settings; |
| 63 |
|
|
| 64 |
sub wanted { |
sub wanted { |
| 65 |
my $pattern = $settings->{options}->{regex}; |
my $pattern = $settings->{options}->{regex}; |
| 66 |
|
my $pattern_exclude = $settings->{options}->{'regex-exclude'}; |
| 67 |
#print "pattern: $pattern", "\n"; |
#print "pattern: $pattern", "\n"; |
| 68 |
if ($File::Find::name =~ m/$pattern/) { |
if ($File::Find::name =~ m/$pattern/) { |
| 69 |
|
if ($pattern_exclude && $File::Find::name =~ m/$pattern_exclude/) { |
| 70 |
|
return; |
| 71 |
|
} |
| 72 |
print $File::Find::name, "\n"; |
print $File::Find::name, "\n"; |
| 73 |
#replaceInFile($File::Find::name); |
#replaceInFile($File::Find::name); |
| 74 |
#exit; |
#exit; |