perl -w >> ftp.log -MNet::FTP -le' ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime(); $year = 1900 + $yearOffset; $theGMTime = "$hour:$minute:$second, $months[$month] $dayOfMonth, $year"; ( $host, $user, $pass, $dir ) = @ARGV; $ftp = Net::FTP->new($host) or die "$@\n"; #send mail if cannot connect do not know how to do it $ftp->login( $user, $pass ) or die $ftp->message; $ftp->cwd($dir) or die $ftp->message; $ftp->binary; for $file ($ftp->ls){ push @files, $file; } for $file (@files) { $quesesto=localtime($ftp->mdtm($file)); $localtimenoformat=localtime(time()); $mdtmnoformat=$ftp->mdtm($file); print "MDTM with FORMAT = $quesesto\n"; print "Localtime No Format = $localtimenoformat\n"; print "MDTM No Format = $mdtmnoformat\n"; #envia_mail (); } $ftp->quit or die $ftp->message; sub envia_mail { print "Content-type: text/html\n\n"; #$title=''; $to="alexis_vasquez\@codetel\.com\.do"; $from= `hostname`; #$subject=''; open(MAIL, "|/usr/sbin/sendmail -t"); ## Mail Header print MAIL "To: $to\n"; print MAIL "From: $from\n"; print MAIL "Subject: $subject\n\n"; ## Mail Body print MAIL "This is a test message \n"; close(MAIL); print "$title\n\n\n"; ## HTML content sent, let use know we sent an email print "

$title

A message has been sent from $from to $to "; } 'host user pass dir