Here's the deal - your are breaking all kinds of rules.
Not the rules you are suppose to break either.
USE STRICT!!
Having said that, here is my interpretation of your code.
I took the liberty of only allowing unix style paths in
the list file - they do not contain trailing slashes.
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"
}
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?
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--
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.