in reply to Testing Files and Directories

There's a module on CPAN to help you with this, File::Listing:
foreach my $entry (File::Listing::parse_dir($ftp->dir())) { my($name, $type, $size, $mtime, $mode) = @$entry; next if $type eq 'f'; # plain file # ... do something with directories ... }