<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

use Net::FTP;
use Getopt::Function qw(maketrue makevalue);
use strict;
use warnings;

my $VERSION = q{.3};

$::opthandler = new Getopt::Function
    [ 
        q{version V&gt;version},
        q{usage h&gt;usage help&gt;usage},
        q{help-opt=s},
        q{verbose:i v&gt;verbose},
        q{silent:i q&gt;silent quiet&gt;silent},
        q{from=s f&gt;from},
        q{to=s t&gt;to},
    ],
    {
    	'from' =&gt; [
    		\&amp;makevalue,
    		q{(required) Location and name of file to send},
    		q{FILE FROM LOCATION},
    	],
	'to'   =&gt; [
		\&amp;makevalue,
		q{(required) Location and name of place to send file to},
		q{FILE TO LOCATION},
	],
    };

$::opthandler-&gt;std_opts;
$::opthandler-&gt;check_opts;

if (!$::to) { die(q{You must specify a location to send file to});		} 
if (!$::from) { die(q{You must specify a location of file to send}); }

my ($username,$password,$host,$path) = $::to =~ m#^ftp://([^\:]+)\:([^\@]+)\@([^\/]+)(.*)$#i;

my $ftp = Net::FTP-&gt;new($host, Debug =&gt; 0) or die qq{Error establishing FTP connection: $@};
$ftp-&gt;login($username,$password) or die q{FTP login failed: [}, $ftp-&gt;code, q{] }, $ftp-&gt;message;

if ($path) {
	$ftp-&gt;cwd("$path") or die q{FTP cwd failed: [}, $ftp-&gt;code, q{] }, $ftp-&gt;message;
}

$ftp-&gt;ascii;
$ftp-&gt;put($::from) or die qq{FTP put of file $::from failed: [} . $ftp-&gt;code . q{] } . $ftp-&gt;message;
$ftp-&gt;quit;

sub usage {

    print qq{\ntransferFromTo.pl [options]\n\n};
    $::opthandler-&gt;list_opts;
    print qq{\n\nCopy file from one place to another.\n\n};

}

sub version {

    print qq{transferFromTo.pl v $VERSION};

}
</pre></body></html>