I don't think you need specify the start/end date unless you want override the value of the current time or specify a different time interval. Perl can figure out the current time and add 1 week to that just fine. Here is a relatively verbose example which I hope gives you a starting point. It only uses Date::Manip for determining the date when specified on the cmdline.

Not sure if you wanted to help on finding the files which actually matched this range too? Readup on localtime to see which array slots code for the values you want and stat to see the information on how to determine when a file was updated/created/last accessed.

#!/usr/bin/perl -w use strict; use POSIX; use Getopt::Long; use Date::Manip; use constant SECONDS_IN_MINUTE => 60; use constant MINUTES_IN_HOUR => 60; use constant HOURS_IN_DAY => 24; use constant DAYS_IN_WEEK => 7; # set some defaults my $sdate = time; my $weekseconds = SECONDS_IN_MINUTE * MINUTES_IN_HOUR * HOURS_IN_DAY * DAYS_IN_WEEK; my $edate = $sdate + ( $weekseconds ); # which can be overridden by your cmd line options # I didn't add anything for the -brtype etc GetOptions( 'sdate:s' => sub { $sdate = &process_date($_[1])}, 'edate:s' => sub { $edate = &process_date($_[1])}); printf("start time is %s, end time is %s\n", strftime("%d %b %Y %H:%M:%S", localtime($sdate)), strftime("%d %b %Y %H:%M:%S", localtime($edate))); sub process_date { my $d = shift; my $date = &ParseDate($d); if( ! $date ) { die("cannot determine date from $d\n"); } return &UnixDate($date, "%s"); }

In reply to Re: kroned Script question by stajich
in thread kroned Script question by amoura

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.