CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Find a pattern from parent directory to all its child directory

 



C_PRASANNA
Novice

Jan 15, 2014, 8:56 PM

Post #1 of 2 (960 views)
Find a pattern from parent directory to all its child directory Can't Post

Hi,

I need to find a pattern in .pl files which is present in parent directory and also in the lot of child directories of the parent folder in windows.

Any idea ?

Thank You....


Kenosis
User

Jan 16, 2014, 8:37 AM

Post #2 of 2 (955 views)
Re: [C_PRASANNA] Find a pattern from parent directory to all its child directory [In reply to] Can't Post

Consider the recursive File::Find::Rule:

Code
use strict; 
use warnings;
use File::Find::Rule;

my $find = 'print';
my $fileType = '*.pl';
my $dir = './';

my @files = File::Find::Rule->file()->grep(qr/\Q$find\E/)->name($fileType)->in($dir);

print "$fileType files which contain '$find':\n\n";
print "$_\n" for @files;


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives