I have two PC connected with each other via LAN cable.
In one of the PC the Perl is installed. What I want to do is transfer the data from one PC to another via Perl.
Is it possible to do this.
---------- Post updated at 11:31 PM ---------- Previous update was at 07:01 AM ----------
use Net::FTP;
use strict;
open (fh, "> abc.txt");
print fh "this is test data\n";
close fh;
my $ftphost='XXXXXX';
my $ftpuser='XXXXXX';
my $ftppass='XXXXXX';
my $outdir= 'C:/';
my $outfile='C:/Users/XXXXXX/Documents/abc.txt';
# FTP the file
my $ftp = Net::FTP->new($ftphost,Debug => 1) || die "Unable to establish ftp connection to $ftphost";
$ftp->login($ftpuser, $ftppass) || die "Unable to log into $ftphost as $ftpuser/$ftppass";
$ftp->ascii || die "Unable to change the Type to Ascii\n";
$ftp->put("$outdir", "$outfile") || die "Unable to ftp $outfile to $ftphost.\n";
$ftp->quit();
print "The data output file $outfile was ftpd to $ftphost \n";
You can use the remote ipaddress or hostname in $ftphost.
You can get the ipaddress by execute ipconfig in command prompt of remote machine and execute hostname in command prompt of remote machine
As you know the user name and password of the remote machine for $ftpuser and $ftppass.