How to get the result via perl FTP script from ETP

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
Welberg
Posts: 1
Joined: Sat Nov 01, 2014 9:11 am

How to get the result via perl FTP script from ETP

Post by Welberg »

Hello,
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;
The output returned is:

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.
How can I get to these 12162 filenames.

THX.

Vincent
void
Developer
Posts: 16669
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to get the result via perl FTP script from ETP

Post by void »

By default, Everything returns 0 results.

Please send the count command to specify the maximum number of results to return with your other commands:

Code: Select all

EVERYTHING COUNT <x>
where <x> is the maximum number of results to return.
Set <x> to 4294967295 to return all results.


For example, something like:

Code: Select all

   $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 COUNT 4294967295" ) or $newErr=1;
   $ftp->cmd( "EVERYTHING QUERY" ) or $newErr=1;
Please note: Gathering date modified and sizes might be a bit slow.
There will be an option to make this instant in the next release of Everything.

For more information, please see:
http://www.voidtools.com/forum/viewtopic.php?f=5&t=1790
Post Reply