#!/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