I am having a bit of trouble understanding what you want. But if appears that you want a report based upon a subset of all .pdf files underneath some directory.
The code below will find all files ending in .pdf in any directory in $base_dir or any directory beneath $base_dir. @pdf_files will contain the full path name to each .pdf file. From this you can find out if each file in ALLFILES exists or not.
If you want a list of all directories that do not contain .pdf files, the code is a bit different. I'm not sure what you mean by eligible or ineligible. Could you show a more concise version of desired output?
#!/usr/bin/perl -w
use strict;
use File::Find;
my $base_dir = "C:/Temp";
my @pdf_files;
find(\&collect_pdf_files, $base_dir);
print @pdf_files;
sub collect_pdf_files
{
return unless (-f); # only real files, not directories
return unless (/.pdf$/); # continue if name ends in .pdf
push (@pdf_files, $File::Find::name);
}
#prints: C:/Temp/something.pdf
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.