}
local *DIR;
- opendir DIR, $dir or die "opendir $dir: $!";
+ # if we can't open the dir, just skip to the next one.
+ opendir DIR, $dir or next;
while ($_ = readdir DIR) {
next if /^\.{1,2}$/;
my $path = "$dir/$_";
my $dir;
foreach $dir (@_) {
local *DIR;
- opendir DIR, $dir or die "opendir $dir: $!";
+ # if we can't open the dir, just skip to the next one.
+ opendir DIR, $dir or next;
while ($_ = readdir DIR) {
# skip if it's current or parent dir.
next if /^\.{1,2}$/;
############################################################################
-# given a directory, this returns an array of all the filenames found therein.
+# given a list of paths, this returns an array of all the filenames found therein.
sub find_files {
my @files_found = ();
my $dir;
foreach $dir (@_) {
+ if (-f $dir) {
+ # that's actually just a file, so add it.
+ push @files_found, $dir;
+ next;
+ }
local *DIR;
- opendir DIR, $dir or die "opendir $dir: $!";
+ # if we can't open the dir, just skip to the next one.
+ opendir DIR, $dir or next;
while ($_ = readdir DIR) {
# skip if it's current or parent dir.
next if /^\.{1,2}$/;