use strict; # Don't forget !
use Net::FTP;
my $host = "your.favorite.server";
my $user = "user";
my $password = "password";
my $f = Net::FTP->new($host) or die "Can't open $host\n";
$f->login($user, $password) or die "Can't log $user in\n";
####
my $dir = "my/favorite/dir";
$f->cwd($dir) or die "Can't cwd to $dir\n";
##
##
my $file_to_get = "something";
my $file_to_put = "other something";
$f->get($file_to_get) or die "Can't get $file from $dir\n";
$f->put($file_to_put) or die "Can't put $file into $dir\n";
##
##
my $file_mdtm = $f->mdtm($file) or die "Can't find $file in $dir\n";
##
##
my $file_mdtm = $f->mdtm($file) or die "Can't find $file in $dir\n";
my $five_days = 3600*24*5; # five days in seconds
if (time - $file_mdtm >= $five_days)
{
print "$file is more than 5 days old\n";
}
##
##
$, = "\n";
my @files = $f->ls;
print @files, "\n";
##
##
$f->ascii();
$f->binary();
##
##
my $f = Net::FTP->new($host) or die "Can't open $host: $@\n";