Hi,
Maybe I'm too stupid to understand the documentation, and maybe examples in the docu are so complex, and I need simple thing.
I'm trying to find some specific file using File::Finder.
Something like: myfile.txt
I do not know in which directory is that file. In case I find it, I'd like to get the full path to it. Other case - undef (or 0).
I managed to get the full list of all files with File::Finder
sub FindFile
{
my $file = shift(@_);
my @directories = @_;
my $pathtofile;
my @allfiles;
unshift(@directories,"./");
@allfiles = File::Finder->in(@directories);
return $pathtofile;
};
I tried to use File::Finder->name($file)->in(@directories) but this gives me only 1 or 0 (if file is there or not).
Of course, when I have this big @allfiles list, I can use foreach and go through and check which one is it, but I hoped if there is already wrapper for File::Find, it should have such search type somehow build in.
Greetings
TheMarty
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.