Hello, I am new to perl, but love it so far. I know this is a very simple problem, but I thought I would ask for some assistance.

I need some help trying to download files from an FTP site based on their timestamp or date format(MMDDYYYY), then send an email if the download was successful or not.

So far I setup Net::FTP to successfully download the file if I specify the exact filename. I have not been able to successfully setup $ftp->_MDTM($file) to download any files that have a timestamp with today's date. I would also like to setup Net::SMTP to send an email stating if the file transfer was successful or not.

Any help or information would help. The following is my current script(not complete by any means).

#!/usr/bin/perl # pegasus_ftp_transfer use Net::FTP; use Time::Format qw(%time %strftime %manip); $ctime="$time{'hh:mm'}"; $cdate=$time{mmddyy}; $file_month=$time{'mmddyy'}; $filename= "property_odd04012004.gz"; $ftp_log="pegasus_ftp_transfer.log"; $down_dir = "c:"; $ftp = Net::FTP->new("host", Debug => 0) or die "Cannot connect to some.host.name: $@"; $ftp->login("user","pass") or die "Cannot login ", $ftp->message; $ftp->ascii; $ftp->cwd("/pegasus") or die "Cannot change working directory ", $ftp->message; $ftp->mdtm ($filename) or die "get failed ", $ftp->message; $ftp->quit; 'mv $filename > $down_dir';

Edit by castaway, added code tags


In reply to FTP pattern matching and email notify by brianlois

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.