use strict; use warnings; use autodie; use Path::Tiny; use Path::Iterator::Rule; my $source = q(Z:\NEW\STUFF); my $pattern = qr(hello.*world); my $destination = q(C:\Users\loops\Desktop\stuff); close *STDERR; open *STDERR, '>', 'copylog.csv'; my $rule = Path::Iterator::Rule->new; $rule->file->line_match($pattern); my $next = $rule->iter( $source ); while ( defined( my $file = $next->() ) ) { eval { path($file)->copy($destination) }; print STDERR $@ ? "$@" : "$file, $pattern\n"; }