#!/usr/bin/perl -w use strict; use Net::FTP; # change preferences to meet your needs my $ftp_srv = 'ftp.ntua.gr'; my $ftp_usr = 'anonymous'; my $ftp_pass = 'me@somewhere.com'; my $ftp_path = '/pub/linux/slackware/slackware-9.0/'; # the main program my $con; $con = Net::FTP->new($ftp_srv, Debug => 1) or die "Unable to connect to $ftp_srv\n". $con->message ."\n"; $con->login($ftp_usr,$ftp_pass) or die "Cannot login: ". $con->message ."\n"; $con->cwd($ftp_path) or die "Cannot change to $ftp_path dir\n".$con->message ."\n"; my @ls = $con->dir('.') or die "Cannot perfom ls command\n".$con->message."\n"; my @readable = map printable_version($_), @ls; $\ = "\n"; print foreach @readable; sub printable_version { shift; /^(.).*\s([^\s]*)$/; "$1 $2"; }