in reply to trouble with glob
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
|
|---|