using ftp from perl script

V

vabby

Hi
I need to use ftp from perl script. below is the script.

#!/opt/perl-5.600/bin/perl
use strict;

use Carp;
use Socket;
use FileHandle;
use File::Basename;
use File::path;
use Sybase::DBlib;
print "FTP sequence initiated\n";

my $host = 'destination.remoste.host.com';
my $usr = ''user_name';
my $pass = 'passwd';
my $file = 'ftpfile.txt';
`ftp -n $host >/home/apariv/perl_learning/ftp.log <<END_SCRIPT`;
`user $usr`;
`$pass`;
`lcd /home/apariv/perl_learning`;
`put $file`;
`quit`;
#END_SCRIPT

the script runs fine w/o any error.ftp.log file remains empty and
there is no file copied to the remote host. can u plz help m efind out
the error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top