#!/usr/local/bin/perl -W # force taint checks, and print warnings use strict; # install all three strictures use File::Copy; use File::Find; my $path = "sourceDirectory"; #define full path to source folder my $newpath = "destinationDirectory"; #define path to new folder my @Filenames; $|++; # force auto flush of output buffer find (\&doCopy, $path); #Recursively search $path for files to copy sub doCopy { return if ! -f $File::Find::name; chdir($path) || die "cannot move to $path"; my $destFile = $newpath . $_; print "\$destFile = $destFile\n"; copy( "$_" , "$destFile" ) or print "File $_ cannot be copied. $!\n"; }