trowa has asked for the wisdom of the Perl Monks concerning the following question:
#use Shell; use Symbol; use IO::Handle; #use Data::Dumper; use Net::FTP; #use File::Copy; my @bsips = qw( 192.168.1.132 192.168.1.133 192.168.1.134 192.168.1.135 ); my @ipsegs = qw( 10.10.10 10.20.20 10.30.30 10.40.40 ); my $uid = "user"; my $pwd = "password"; my $rdir = "/rdir/data"; my $ldir = "/ldir/data"; my $tmpdir = "/opt/perl/tmp"; my $pathlog = "/opt/perl/tmp/ftp.log"; ## more subs here, not included (hash population) sub ftp2bs { ($uid, $pwd, $rdir, $ldir, $pathlog, $bsips, $hbs) = @_; for $gx (keys %$hbs) { #print "$gx ------------- $gx\n"; chdir "$ldir" or die "error: $!\n"; $ftp=Net::FTP->new($gx); neterr($ftp); $ftp->login($uid,$pwd); neterr($ftp); $ftp->binary(); neterr($ftp); $ftp->cwd($rdir); neterr($ftp); for $i (0..$#{$hbs{$gx}}) { my $fnx = $hbs{$gx}[$i]; ### LOOK HERE if (-w $ldir."/".$fnx && -M $ldir."/".$fnx>0.0007) { #print "$gx: $hbs{$gx}[$i]\n"; $ftp->put($ldir."/".$fnx); # print $ftp->message(), ""; # neterr($ftp); } } $ftp->close; neterr($ftp); $ftp->quit; neterr($ftp); } } sub io4ls { ($tmpdir, $pathlog, $hbs) = @_; for $gx (keys %$hbs) { my $fhw = gensym; open $fhw, ">>$tmpdir/$gx.list" or die "error: $!\n"; #print "$gx ------------------- $gx\n"; for $i (0..$#{$hbs{$gx}}) { my $fnx = $hbs{$gx}[$i]; ## AND HERE if (-w $ldir."/".$fnx && -M $ldir."/".$fnx > 0.0007) { #print "$gx: $hbs{$gx}[$i]\n"; print $fhw "$hbs{$gx}[$i]\n"; } } close $fhw; } } ftp2bs($uid, $pwd, $rdir, $ldir, $pathlog, \@bsips, \%hbs); io4ls($tmpdir, $pathlog, \%hbs);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: file test modifier -M and midnight rollover
by merlyn (Sage) on Mar 20, 2002 at 20:31 UTC | |
by trowa (Acolyte) on Mar 20, 2002 at 20:48 UTC |