#!/usr/bin/perl -w use strict; use warnings; use Cwd qw(getcwd); use File::Copy; use File::Find; use Net::Telnet; use Net::FTP; my %options=(); GetOptions (\%options, 'loc=s') or die("\nERROR:Invalid Option\n"); my $location= $options{loc}; my %files = map {$_ => 1} qw(data.txt scripts.pl); find(sub { copy($File::Find::name, $cwd) or die "Can't cp $File::Find::name: $!" if (delete $files{$_}); }, $location); $ftp = Net::FTP->new("129.186.0.100", Debug => 0) or die "Cannot connect to the target: $@"; $ftp->login("root","root") or die "Cannot login ", $ftp->message; $ftp->cwd("/mnt/data") or die "Cannot change working directory ", $ftp->message; $ftp->binary(); $ftp->put("data.txt") or die "put failed ", $ftp->message;; $ftp->put("scripts.pl") or die "put failed ", $ftp->message; $ftp->quit();