$match =~ s/\*/.*/g; # replace asterisks with dot star.
$match =~ s/\+/\\+/g; # escape plusses.
$match =~ s/\?/\\?/g; # escape question marks.
- $match =~ s/\|/\\?/g; # escape pipe char.
+ $match =~ s/\|/\\|/g; # escape pipe char.
$match =~ s/\$/\\\$/g; # escape dollar sign.
$match =~ s/\[/\\[/g; # escape open bracket.
$match =~ s/\]/\\]/g; # escape close bracket.
if ($possible_name =~ /$match/) {
# this one matches so add it.
push @to_return, $chopped_filename[0] . $possible_name;
+#print "a match on: $chopped_filename\n";
}
}
}
}
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}$/;
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}$/;