in reply to copy directories
But alas, it does not work. The problem is remembing what path to copy to - File::Find will handle recursing into the source directory, but how do you maintain a synchronized recursing into the target directory?use strict; use IO::File; use File::Find; use File::Copy; &USAGE,exit unless my ($file,$list) = @ARGV; #open data for user file my $LIST = new IO::File($list) or die "Cannot open user : $!\n"; my @DIR = <$LIST> or die "List file is empty!\n"; $LIST->close; foreach my $target (@DIR) { chomp $target; find sub { return if /^\./; if (-f) { print "cp $_ $target/$_\n"; #copy($_,"$target/$_"); } elsif (-d) { print "mkdir $target/$_\n"; #mkdir("$target/$_",0711); } }, $file; } sub USAGE { print "Usage: perl sendfile.pl <file(s)> <group list>\n" }
So, since I can't solve your problem I will re-ask the monks:
What is the best way to mirror a directory tree using Perl?
Jeff
R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
L-L--L-L--L-L--L-L--L-L--L-L--L-L--
|
|---|