for my $path (dir($source)->children) { next if $path =~ /^\./; # exclude hidden files and directories next unless $path->is_dir; # exclude files my $target = dir($dest, $path->basename); dircopy $path, $target or die "Error copying $path: $!"; }