@data=$ftp->ls("-R"); foreach $line (@data) { if !($line =~ m/^\.{1,2}/){ print "fetching " . $line . "\n"; $ftp->get($line) ; } }