for my $filename ($ftp->ls) { my $filetime = $ftp->mdtm($filename) or die "mdtm failed ", $ftp->message; # here check if filetime is in your range }