Hi all, don't know almost nothing about perl but I'm RTFM.
Dimitre Radoulov gave a perl script to get and delete via ftp some
files. now i want generate a log file with those file names.
I only added the lines starting in uppercase
perl -MNet::FTP -le'
( $host, $user, $pass, $dir ) = @ARGV;
$MY_FILE = "recibidos.txt";
OPEN(PLOT,">>$MY_FILE") or die("The file cannot be opened!");
$ftp = Net::FTP->new($host) or die "$...@\n";
$ftp->login( $user, $pass ) or die $ftp->message;
$ftp->cwd($dir) or die $ftp->message;
$ftp->binary;
/(.*)\.tag$/ and $files_ko{$1} = 1
or push @files, $_
for $ftp->ls;
for (@files) {
$ftp->get($_) and $ftp->delete($_)
unless exists $files_ko{$_};
CHOMP;
PRINT PLOT "$_\n";
}
$ftp->quit or die $ftp->message;
CLOSE(PLOT)
' <host> <user> <pass> <dir>
Undefined subroutine &main::OPEN called at -e line 4.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/