Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Using grep and glob to find directories containing file

by arnaud99 (Beadle)
on Feb 06, 2013 at 12:06 UTC ( #1017399=note: print w/ replies, xml ) Need Help??


in reply to Using grep and glob to find directories containing file

Hi, I have just noticed your post and would like to propose an alternative approach. It uses the File::Find::Rule package and simplify things (in my view). This is running on perl 5.16.0

use strict; use warnings; use autodie; use File::Find::Rule; my @f_files = File::Find::Rule ->file ->name(qr/^f.*$/) ->in(qw(/dir1 /dir2 /dir3 )); foreach (@f_files) { print "$_\n"; }
The output looks like:
$ perl find_f_files.pl /dir1/f2.dat /dir1/f.dat /dir1/subdir1/f2.dat /dir1/subdir1/f.dat /dir3/subdir3/f3.dat
I hope this helps.


Comment on Re: Using grep and glob to find directories containing file
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017399]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2015-07-03 21:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (56 votes), past polls