my $stamp; # set to appropriate epoch time stamp my @files = $ftp->ls(); chomp( @files ); for my $file ( @files ) { print "Testing file : $file\n"; if ( $file !~ /\.stm$/ ) { print "Skipping : $file is not an .stm file\n"; next; } my $mtime = $ftp->mdtm($file); die "cannot get mdtm for $file\n" if ! $mtime; print "$file last modified : ", scalar localtime($mtime), "\n"; if ( $mtime < $stamp ) { print "Removing file : $file\n"; $ftp->delete($file); print $ftp->message, "\n"; } }