Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Q regarding glob

by stephen (Priest)
on May 17, 2013 at 00:21 UTC ( #1033928=note: print w/ replies, xml ) Need Help??


in reply to Q regarding glob

Easiest way is probably to use File::Slurp.

Here's an untested example:

#!env perl use strict; use warnings; use File::Slurp qw/read_dir/; my $Dir_Prefix = '../../dir1/dir2'; my $File_Path = 'dir3/filename'; MAIN: { my @files = read_dir($Dir_Prefix); foreach my $file (@files) { -d $file or next; if (-e "$Dir_Prefix/$file/$File_Path") { print "$file\n"; } } }

Update:Updated from a File::Find example.

stephen


Comment on Re: Q regarding glob
Download Code
Replies are listed 'Best First'.
Re^2: Q regarding glob
by arunagiri (Initiate) on May 17, 2013 at 00:53 UTC
    That's Informative and usefull. Thanks

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (12)
As of 2015-07-28 08:52 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 (254 votes), past polls