sravs448 has asked for the wisdom of the Perl Monks concerning the following question:
Directory Structureuse strict; use warnings; use Data::Dump; use File::Find::Rule; my $output = "/abc/def/ghi"; my @exclude_dirs = qw(OLD); my $rule = File::Find::Rule->new; $rule->or($rule->new ->file() ->name(@exclude_dirs) ->prune ->discard, $rule->new); my @files = $rule->in("$output"); dd \@files;
Desired Output:/abc/def/ghi/Project1/ /abc/def/ghi/Project1/2013 /abc/def/ghi/Project1/2013/file1_project1.txt /abc/def/ghi/Project1/20l4 /abc/def/ghi/Project1/2014/foobar_2014_0912_255.txt /abc/def/ghi/Project1/2014/foobar_2014_0916_248.txt /abc/def/ghi/Project2 /abc/def/ghi/Project2/2013 /abc/def/ghi/Project1/2013/file2_project1.txt /abc/def/ghi/Project2/2014 /abc/def/ghi/Project2/2014/foobarbaz_2014_0912_255.txt /abc/def/ghi/Project2/2014/foobarbaz_2014_0912_248.txt
/abc/def/ghi/Project1/2014/foobar_2014_0912_255.txt /abc/def/ghi/Project2/2014/foobarbaz_2014_0912_248.txt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl - File::Find::Rule to exclude a single dir
by shmem (Chancellor) on Sep 17, 2014 at 20:53 UTC | |
|
Re: perl - File::Find::Rule to exclude a single dir
by Anonymous Monk on Sep 17, 2014 at 21:38 UTC | |
by sravs448 (Acolyte) on Sep 17, 2014 at 22:02 UTC | |
|
Re: perl - File::Find::Rule to exclude a single dir
by Anonymous Monk on Sep 17, 2014 at 21:08 UTC | |
by sravs448 (Acolyte) on Sep 17, 2014 at 22:41 UTC | |
|
Re: perl - File::Find::Rule to exclude a single dir
by Anonymous Monk on Sep 18, 2014 at 02:28 UTC |