Still cant't figure out how to check if file is newer that an hour. I can get this:

MDTM with FORMAT = Fri Aug 21 12:23:15 2009 Localtime No Format = Fri Aug 13 10:17:10 2010 MDTM No Format = 1250871795

but don't know how to get the 'localtime with NO Format' to compare with the 'MDTM with NO Format'

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, $yea +r"; ( $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 "<html><head><title>$title</title></head>\n<body>\n\n"; ## HTML content sent, let use know we sent an email print " <h1>$title</h1> A message has been sent from $from to $to </body></html>"; } 'host user pass dir

In reply to Re^2: Newbie: how evaluate files newer than an hour within ftp by Anonymous Monk
in thread Newbie: how evaluate files newer than an hour within ftp by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.