in reply to Copy files and subdirectories

Maybe: File::Copy::recursive

MH

Replies are listed 'Best First'.
Re^2: Copy files and subdirectories
by g_speran (Scribe) on Jun 09, 2011 at 16:15 UTC
    I looked into that module as well, but if I read it correctly, it did state that the developer was working on the EXCLUDE portion of it. So, in the mean time I went with the following code. If anybody has any other recommendations, where it can be portable, i would appreciate the feedback.
    my $source = 'c:/win/data'; my $to_dir= 'c:/temp/DATA'; use File::Path; mkpath(${to_dir}) or die "mkdir '${to_dir}' failed: $!" if not -e $to_ +dir; open(FH,">${to_dir}/EXCLUDE.txt"); print FH ".lck\n"; close FH; my $xcopy = $ENV{'systemroot'} . '\\system32\\xcopy.exe'; my $exclude="${to_dir}/EXCLUDE.txt"; $exclude =~ s/\//\\/g; my $command = qq{("$xcopy" "$source" "$to_dir" /E /I /F /R /Y /EXCLUDE +:$exclude)}; print $command . "\n"; system($command); unlink $exclude;