#!/usr/bin/perl -w use strict; use warnings; use Cwd qw(getcwd); use File::Copy; use File::Find; my $dir = shift; print "$dir\n"; my $cwd = getcwd; my %files = map {$_ => 1} qw(data.txt datascript.pl); find(sub { copy($File::Find::name, $cwd) or die "Can't cp $File::Find::name: $!" if (delete $files{$_}); }, $dir);