J
Jing
The system admin. has a problem to configure the Makefile.pl for
Net::FTP module. my program need to ftp a local files to a remote
server. Since i can't use Net::FTP, i try to use ftp command instead.
I got trouble to write error message to a log file while processing
the ftp command. Here is my code for ftp files.
#!/opt/perl/bin/perl -w
use File::Copy;
$remotehost1 ="a";
$remotepath ="/b";
$remoteuser ="c";
$remotepass ="d";
$fileftp = "test.txt";
$dirfrom="/e";
$cmd="ftp -n";
my $ftp_commands =
" open $remotehost1
user $remoteuser $remotepass
lcd $dirfrom
cd $remotepath
asc
put $fileftp
bye
";
open (CMD, "|$cmd");
print CMD $ftp_commands;
close (CMD);
print "Ftp commands : $ftp_commands";
print "File $fileftp has been transferred \n";
$finish = 'temp';
copy ("$fileftp","./$finish/$fileftp");
thanks
Net::FTP module. my program need to ftp a local files to a remote
server. Since i can't use Net::FTP, i try to use ftp command instead.
I got trouble to write error message to a log file while processing
the ftp command. Here is my code for ftp files.
#!/opt/perl/bin/perl -w
use File::Copy;
$remotehost1 ="a";
$remotepath ="/b";
$remoteuser ="c";
$remotepass ="d";
$fileftp = "test.txt";
$dirfrom="/e";
$cmd="ftp -n";
my $ftp_commands =
" open $remotehost1
user $remoteuser $remotepass
lcd $dirfrom
cd $remotepath
asc
put $fileftp
bye
";
open (CMD, "|$cmd");
print CMD $ftp_commands;
close (CMD);
print "Ftp commands : $ftp_commands";
print "File $fileftp has been transferred \n";
$finish = 'temp';
copy ("$fileftp","./$finish/$fileftp");
thanks