How attached are you to this function? (is it homework)
See Re^2: getting picky with File::Find::Rule less typing find/rule
#!/usr/bin/perl -- use strict; use warnings; use Path::Tiny qw/ path /; use File::Find::Rule qw/ find rule /; path('gonetoday')->remove_tree; path($_)->touchpath for qw{ gonetoday/a/hi.html gonetoday/a/a.html gonetoday/a/b.html gonetoday/b/bye.html gonetoday/b/a.html gonetoday/b/b.html }; print "$_\n" for find( file => in => 'gonetoday' ); print "and no beee\n"; my $nobaby = rule( directory => name =>[ 'b', ], qw/ prune discard /); my $yeshtml = rule( file => name => qr/\.html/i ); print "$_\n" for rule()->or( $nobaby, $yeshtml )->in( 'gonetoday'); path('gonetoday')->remove_tree; __END__ gonetoday/a/a.html gonetoday/a/b.html gonetoday/a/hi.html gonetoday/b/a.html gonetoday/b/b.html gonetoday/b/bye.html and no beee gonetoday/a/a.html gonetoday/a/b.html gonetoday/a/hi.html
In reply to Re: Need help with Omitting a directory from this function (file find rule ignore directory )
by Anonymous Monk
in thread Need help with Omitting a directory from this function
by gotsilk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |