#!/usr/bin/perl use strict; use warnings; use Net::FTP; my $host = 'ServerName'; my $ftp = Net::FTP->new($host, Timeout => 1800) or die "Cannot contact $host: $!"; $ftp->login('ID', 'PWD') or die "Cannot login ($host):" . $ftp->message; my $dir = '/path/to/files'; chdir $dir or die "Can't cd to $dir: $!"; # E.g., all txt files my @files= grep -f, <*.txt>; foreach $file (@files) { $ftp->put($file) or warn "Could not put $file: ".$ftp->message(); } $ftp->quit; exit;