in reply to Formatting Regex for File::Find::Rule
$rule->new->directory->name( @dirExclusionsQR )->prune->discard
->prune means not to descend into that directory. Your fist match is ., so File::Find::Rule isn't even descending past the base directory. Second, note that ->name matches on the basename only, so the extra slashes you've got in there won't match. This works for me, hopefully it's what you're looking for:
use warnings; use strict; use File::Find::Rule; my $tagLocation = '...'; my @dirExclusions = qw/ LOG cache AVCHD /; my $rule = File::Find::Rule->new; $rule->or( $rule->new->directory->name( @dirExclusions )->prune->discard, $rule->new->directory ); my @fileList = $rule->in($tagLocation);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Formatting Regex for File::Find::Rule
by springgem (Novice) on Apr 09, 2021 at 15:20 UTC | |
by haukex (Archbishop) on Apr 09, 2021 at 15:49 UTC | |
by springgem (Novice) on Apr 09, 2021 at 16:59 UTC | |
by haukex (Archbishop) on Apr 09, 2021 at 17:32 UTC |