You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
537 B
22 lines
537 B
#!/usr/bin/perl -w
|
|
use strict;
|
|
use File::Find;
|
|
my $code = shift @ARGV || usage();
|
|
push @ARGV, '.' unless @ARGV;
|
|
find({ wanted => \&process, follow => 1 }, @ARGV );
|
|
|
|
sub process {
|
|
my $name = $File::Find::name;
|
|
my $dir = $File::Find::dir;
|
|
eval qq{$code};
|
|
}
|
|
|
|
sub usage {
|
|
print <<USAGE;
|
|
Usage: $0 'print "\$name\\n" if \$name =~ m/foo/i' some/dirs to/search ...
|
|
where \$name = full file path name
|
|
\$dir = containing directory name
|
|
\$_ = file name without directory
|
|
USAGE
|
|
exit 0;
|
|
}
|
|
|