[sf-perl] (no subject)

yary not.com at gmail.com
Fri Aug 6 08:39:49 PDT 2010


On Fri, Aug 6, 2010 at 7:22 AM, Lemseffer. Tahar (SDA)
<lemseffert at sacsewer.com> wrote:
> Thank you for your reply
> Here is my delima.
> I have an FTp_report.pl  that I use to send reports from different
> directories to MIs server.
> I want to be able to compare the date to a file date and then send the
> reports..for instance:
> If I want to send only reports from 7/10 to 7/15....
> I have 10 directories that I sent reports from to an MIS server.
> Please let me know if need to clarify my request?
> I can send you The script I have now if you would like!
> Thank you for your help in advance

You can get the age of a file using -M, so if you want to send file
newer than 10 days for example-

use constant { age_limit=>10 };

for my $file (<*/*.txt>) # text files in directories 1 level down
  {
  if (-M $file < age_limit) {
    print "Sending $file\n";
   #... ftp_send($file)
  }
}

That doesn't exactly answer your question on filtering on a date range
though. For that you'd probably want to use a date handling module
from cpan.

Follow up any responses to the list address


More information about the SanFrancisco-pm mailing list