I have a perl script with which I connect on port 2121 to ETP/FTP. I want to search for files with "PKL". And I want path, filename and modified time returned.
What should I adjust to get the data returned?
Code: Select all
sub CCC() {
# -----------------------------------------------------
#
my $strFTPHost = shift();
my $strFTPPort = shift();
$newErr = 0;
$ftp=Net::FTP->new(Host => $strFTPHost, Port => $strFTPPort, Timeout => 240, Debug => 1, Passive => 0) or $newErr=1;
if ($newErr) {
push @ERRORS, "Can't ftp to $strFTPHost: $!\n";
Z008_FTP_ERR();
}
printf("VVH20141101001|Connected %s\n", $strFTPPort);
STDOUT->flush();
STDERR->flush();
$ftp->login("anonymous",'-anonymous@') or $newErr=1;
if ($newErr) {
push @ERRORS, "Can't login to $strFTPHost: $!\n";
$ftp->quit;
Z008_FTP_ERR();
}
printf("VVH20141101002|Logged in %s\n", $strFTPPort);
STDOUT->flush();
STDERR->flush();
@lines=$ftp->feature( "EVERYTHING" ) or $newErr=1;
if ($newErr) {
}
else {
foreach(@lines) {
printf("VVH20141101004 : %s\n", $_);
STDOUT->flush();
STDERR->flush();
}
}
$ftp->cmd( "EVERYTHING SEARCH PKL" ) or $newErr=1;
if ($newErr) {
printf("VVH20141101005 : %s\n", $_);
STDOUT->flush();
STDERR->flush();
}
$ftp->cmd( "EVERYTHING PATH_COLUMN 1" ) or $newErr=1;
$ftp->cmd( "EVERYTHING FILE_LIST_FILENAME_COLUMN 2" ) or $newErr=1;
$ftp->cmd( "EVERYTHING DATE_MODIFIED_COLUMN 3" ) or $newErr=1;
$ftp->cmd( "EVERYTHING QUERY" ) or $newErr=1;
if ($newErr) {
}
else {
}
$ftp->quit;
Code: Select all
Net::FTP>>> Net::FTP(2.77)
Net::FTP>>> Exporter(5.67)
Net::FTP>>> Net::Cmd(2.29)
Net::FTP>>> IO::Socket::INET(1.33)
Net::FTP>>> IO::Socket(1.34)
Net::FTP>>> IO::Handle(1.33)
Net::FTP=GLOB(0x8954f84)<<< 220 Welcome to Everything ETP/FTP
VVH20141101001|Connected 2121
Net::FTP=GLOB(0x8954f84)>>> USER anonymous
Net::FTP=GLOB(0x8954f84)<<< 230 Logged on.
VVH20141101002|Logged in 2121
Net::FTP=GLOB(0x8954f84)>>> FEAT
Net::FTP=GLOB(0x8954f84)<<< 211-Features:
Net::FTP=GLOB(0x8954f84)<<< MDTM
Net::FTP=GLOB(0x8954f84)<<< REST STREAM
Net::FTP=GLOB(0x8954f84)<<< SIZE
Net::FTP=GLOB(0x8954f84)<<< MLST type*;size*;modify*;
Net::FTP=GLOB(0x8954f84)<<< MLSD
Net::FTP=GLOB(0x8954f84)<<< UTF8
Net::FTP=GLOB(0x8954f84)<<< EVERYTHING
Net::FTP=GLOB(0x8954f84)<<< 211 End
VVH20141101004 : EVERYTHING
Net::FTP=GLOB(0x8954f84)>>> EVERYTHING SEARCH PKL
Net::FTP=GLOB(0x8954f84)<<< 200 Search set to (PKL).
Net::FTP=GLOB(0x8954f84)>>> EVERYTHING PATH_COLUMN 1
Net::FTP=GLOB(0x8954f84)<<< 200 Path column set to (1).
Net::FTP=GLOB(0x8954f84)>>> EVERYTHING FILE_LIST_FILENAME_COLUMN 2
Net::FTP=GLOB(0x8954f84)<<< 200 File list filename column set to (2).
Net::FTP=GLOB(0x8954f84)>>> EVERYTHING DATE_MODIFIED_COLUMN 3
Net::FTP=GLOB(0x8954f84)<<< 200 Date modified column set to (3).
Net::FTP=GLOB(0x8954f84)>>> EVERYTHING QUERY
Net::FTP=GLOB(0x8954f84)<<< 200-Query results
Net::FTP=GLOB(0x8954f84)<<< RESULT_COUNT 12162
Net::FTP=GLOB(0x8954f84)<<< 200 End.
Net::FTP=GLOB(0x8954f84)>>> QUIT
Net::FTP=GLOB(0x8954f84)<<< 221 Goodbye.
THX.
Vincent