|
|
Question : File::Find pattern match
|
|
I need to find files that are CVS lock files and delete them, descending into multiple subdirectories to find them all. My script is this:
#!/usr/bin/perl
use File::Find;
$find=$ARGV[0]; find({ wanted => \&wanted_files, no_chdir => 1 }, '/home/cvs/eng');
sub wanted_files { if(($File::Find::name=~m!^/home/cvs/eng/$find/[/\#cvs/]$!) { print "$File::Find::name"; } }
where $find is the root subdirectory under /home/cvs/eng that I want to search. I want to match files with pattern ^#cvs*, but the above File::Find::name search doesn't work. How do I rewrite that correctly?
|
Answer : File::Find pattern match
|
|
m!^/home/cvs/eng/$find/#cvs! should do that
|
|
|
|
|