[sf-perl] (no subject)

Lemseffer. Tahar (SDA) lemseffert at sacsewer.com
Fri Aug 6 08:44:53 PDT 2010


Thank you for your response here is my actual script :
#!/usr/local/bin/perl -w
                                                                         
use Sys::Syslog;

$subetotal_pccs  ='/usr/reports/subetotal/SubEtotal_08-06-2010.CSV';
$subetotal_mis   ='/pccsdata/Reports/Eusage/';

$lnwih2s_pccs    ='/usr/reports/lnwih2s/lnwih2s_08-06-2010.CSV';
$lnwih2s_mis     ='/pccsdata/Reports/LNWI';

$dailylog_pccs   ='/usr/reports/dailylog/DailyLog_08-06-2010.CSV';
$dailylog_mis    ='/pccs/tahar';

$n16_pccs        ='/usr/jpc/reports/n16/n16_08-06-2010.CSV';
$n16_mis         ='/pccsdata/Reports/hydraulics';

$command = '/usr/develop/apps/ftp_report.pl';

$program = $0;
$logopt = 'cons, pid';
$facility = 'HSR';

 # set up the syslog messages.
  openlog($program, $logopt, $facility);

 # send the subetotal to MIS.
  @args = ($command, $subetotal_pccs, $subetotal_mis);
  print @args;
   if ( system (@args) == 0 ) {
 # Do Nothing
   } else {
    syslog('LOG_ALERT|LOG_LOCAL0', 'Failed to send %s to MIS', $subelectotal_pccs);
    die ();
   }

 # send the lnwih2s_pccs to MIS.
  @args = ($command, $lnwih2s_pccs, $lnwih2s_mis);
    if ( system (@args) == 0 ) {
 # do Nothing
  } else {   
    syslog('LOG_ALERT|LOG_LOCAL0', 'Failed to send %s to MIS', $lnwih2s_pccs);
    die ();
  }

# send the dailylog_pccs to MIS.
  @args = ($command, $dailylog_pccs, $dailylog_mis);
    if ( system (@args) == 0 ) {
 # Do Nothing
  } else {    
    syslog('LOG_ALERT|LOG_LOCAL0', 'Failed to send %s to MIS', $dailylog_pccs);
    die ();
  }
  
 # send the n16_pccs to MIS.
  @args = ($command, $n16_pccs, $n16_mis);
    if ( system (@args) == 0 ) {
 # Do Nothing
  } else {   
    syslog('LOG_ALERT|LOG_LOCAL0', 'Failed to send %s to MIS', $n16_pccs);
    die ();
  }

 closelog();
With this script .. I can ftp reports to MIs server so far, but I'm having trouble using the date comapisant

Help!
Thanks

-----Original Message-----
From: yary [mailto:not.com at gmail.com] 
Sent: Friday, August 06, 2010 8:40 AM
To: Lemseffer. Tahar (SDA); sanfrancisco-pm
Subject: Re: [sf-perl] (no subject)

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
____________________________________________________________________________
EMAIL DISCLAIMER:
This email and any attachments thereto may contain private, confidential, and
privileged material for the sole use of the intended recipient. Any review,
copying, or distribution of this email (or any attachments thereto) by other
than the intended recipient is strictly prohibited.

If you are not the intended recipient, please contact the sender immediately
and permanently delete the original and any copies of this email and any
attachments thereto.
_____________________________________________________________________________



More information about the SanFrancisco-pm mailing list