#!/usr/bin/perl use strict; use warnings; use Path::Class; use File::Copy::Recursive qw/ dircopy /; my $source = "/pr/perl_by_example"; my $dest = "/pr/book"; for my $path (dir($source)->children) { next if $path =~ /\./; my $target = dir($dest, $path->basename); dircopy $path, $target or die "Error copying $path: $!"; }