Are you using Net::FTP?
Because that its documentation says that $ftp->ls($dir) returns a directory listing.
Assuming that to be the case, then something like this should work.
use strict;
use warnings;
my @files_to_check = ( 'abc.txt', 'xyz.txt', 'efg.txt' ); # list
+of files to check
my @directory_listing = $ftp->ls($dir);
my %files_on_FTP_server;
foreach my $file (@directory_listing)
{
# extra processing here?
$files_on_FTP_server{$file} = 1;
}
foreach my $file (@files_to_check)
{
if ( ! $files_on_FTP_server{$file} ) { print "File $file is missin
+g\n"; }
}
However, as I do not know the format of @directory_listing, you might need some extra processing where indicated on line 12.
If @directory_listing contains a line of info for each file, you'd need a regexp to extract the file from each line, and you'd change line 10 from
foreach my $file (@directory_listing) to:
foreach my $line (@directory_listing)
UPDATE: s/Net::FTP/Net::FTP/ (ie linkified it)
s/that/its documentation/
| [reply] [d/l] [select] |