use strict; use File::NCopy qw(copy); my $dir = shift; my $new = 'destination'; -d $dir or die $!; -d $new or mkdir $new; my @files = grep { -f } glob "$dir/*"; copy $_, $new for @files