If you don't mind escaping to the shell, this is how I get a list of files I want to ftp.
#This returns a list of files to be ftp'ed my $files = `ls`;
#turn the files variable into an array of file names. my @ftpfiles = split(/\n/ , $files);
Sincerely,
Gregg R. Allen I.T. Specialist Lexington Law Firm
On Thursday, Jul 10, 2003, at 04:13 US/Mountain, Sara wrote:
#!/usr/bin/perl -w
use strict; use warnings; use CGI::Carp 'fatalsToBrowser'; use CGI qw/:standard/; use Net::FTP;
my $ftp = Net::FTP->new("ftp.yourserver.com", Debug => 0) or die "Cannot connect to some.host.name: $@";
$ftp->login("username",'password') or die "Cannot login ", $ftp->message;
$ftp->cwd("/") or die "Cannot change working directory ", $ftp->message;
my @Directory = $ftp->dir("/path/to/directory"); print "@Directory";
$ftp->quit;
I am using the following to login to remote FTP;
and its working fine and I am getting the list of files from remote FTP from my desired directory but;
- The script is working fine in my Window IDE and giving an Internal Server Error (without any error message) while on my Host.
- its returning @Directory in long format "-rw-r--r-- 1 username username 8654 Jul 5 18:20 test.html" Is it possible to get file names only like test.html
and how to provide $Directory in the script given below because above is an array context @Directory?
because after getting the list of files from the directory above I want to match/compare the file names with a text list on my server, see below.....
################################### $my Directory = ".";
if ( open( NO, 'data.txt' ) ) { while ( <NO> ) { chomp; # Optional: Add check for blank/incomplete lines.
if ( -f "$Directory/$_" )
{
print "File '$_' exists in '$Directory'.\n";
# Optional: Add file to 'exists' list for later reporting.
}
else
{
print "File '$_' does NOT exist in '$Directory'.\n";
# Optional: Add file to 'not exists' list for later reporting.
}
}
close( NO );
}
else
{
print "ERROR: Unable to open file: $!\n";
}
Thanks,
SARA.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]