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 \n" }