The same thing using File::Find::Rule

#!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd pp /; use Path::Tiny qw/ path /; use File::Find::Rule qw/ find /; my $thisdir = shift || path( __FILE__ )->parent; my @all = File::Find::Rule->in( "$thisdir" ); my @dirs = File::Find::Rule->directory ->name( qr/^[IPD]\d{8}$/ ) ->prune ## don't descend ->in( $thisdir ); dd( \@all, \@dirs ); dd( find( directory => name => qr/^[IPD]\d{8}$/, prune => ## don't descend in => $thisdir, ) ); __END__ $ perl ffindrule.pl . ( [ ".", "ffindrule.pl", "a", "a/echo.txt", "a/q", "a/q/echo.txt", "a/r", "a/r/D20131114", "a/r/D20131114/fa", "a/r/I20131114", "a/r/I20131114/fa", "a/r/P20131114", "a/r/P20131114/fa", "a/r/P20131114/P20131114", "b", "b/echo.txt", "b/s", "b/s/D20131114", "b/s/D20131114/away", "b/s/I20131114", "b/s/I20131114/ru", "b/s/P20131114", "b/s/P20131114/P20131114", "b/s/P20131114/run", "b/s/t", "b/s/t/o", "b/s/t/o/p", "b/s/t/o/p/D20131114", "b/s/t/o/p/I20131114", "b/s/t/o/p/P20131114", "b/t", "b/t/echo.txt", ], [ "a/r/D20131114", "a/r/I20131114", "a/r/P20131114", "b/s/D20131114", "b/s/I20131114", "b/s/P20131114", "b/s/t/o/p/D20131114", "b/s/t/o/p/I20131114", "b/s/t/o/p/P20131114", ], ) ( "a/r/D20131114", "a/r/I20131114", "a/r/P20131114", "b/s/D20131114", "b/s/I20131114", "b/s/P20131114", "b/s/t/o/p/D20131114", "b/s/t/o/p/I20131114", "b/s/t/o/p/P20131114", )

http://p3rl.org/Data::Dump http://p3rl.org/Path::Tiny http://p3rl.org/File::Find::Rule


In reply to Re^2: Limiting file:find depth question by Anonymous Monk
in thread Limiting file:find depth question by RockE

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.