#!/usr/bin/perl use Net::FTP; use Net::Telnet; $MPG_DIR = "/testpl"; opendir(MDIR, $MPG_DIR) or die "Could not open dir $MPG_DIR for reading: $!\n"; @files = grep(/\.mpg$/, readdir(MDIR)); closedir(MDIR); $ftp = Net::FTP->new("IP ADDRESS HERE", Debug => 9) or die "can't connect: $@\n"; ##### ####Maybe try pasv connection? # $ftp->pasv(); ##### $ftp->login("user", "password") or die "couldn't login\n"; $ftp->cwd("/mds/nvision1") or die "couldn't change directory\n"; #$ftp->quot("bin"); $ftp->binary(); #$ftp->quot("prompt"); $ftp->quot("allo 17595824"); foreach $x ( @files ) { # Does put populate $@ with error messages? If so, inspect them: $ftp->put($x) or die "couldn't put $x: $@\n"; } $ftp->quit; # outta here $t = Net::Telnet->new => (Timeout => 2000, Prompt => '/%/', Host => $hostname ); $t->login($user, $password); foreach $x ( @files ) { print $t "vstag -E mpi /mds/nvision1/$x\n"; } $t->close; # Redundant...to keep track of all of these, just put them near the # top. #use Net::FTP; $ftp = Net::FTP->new("IP ADDRESS HERE") or die "can't connect: $@\n"; $ftp->login("user", "password") or die "couldn't login\n"; $ftp->cwd("/mds/nvision1") or die "couldn't change directory\n"; print $ftp "bin\n"; print $ftp "prompt\n"; foreach $x ( @files ) {($a, $b) = split(/\.[^.]+$/, $x); # Check $@ if indeed Net::FTP populates it on get failure $ftp->get($x) or die "couldn't get $filename: $@\n"; } $ftp->quit; # outta here