#!/usr/bin/perl -- use strict; use warnings; use Path::Tiny qw/ path cwd /; my @files = grep { -f $_ } path( '/pr/perl_by_example/' )->children(); for my $source ( @files ) { my $destination = path( "/pr/book/", $source->basename ); $source->copy( $destination ); }