This won't work, because it returns the current date. First, there's a typo in my post. The example should read:



/export/home/mars-stats/device/config/2000/0825/blah/blah/blah.txt

Your code would return:

"blah-Sun_Aug_27_03:18:29_2000.txt"

Which is a problem, if I want to run the program on a month old file, and create a file with THAT date on it. So, my new brilliant (?) idea is the following: Since each day, a new directory is created which contains the files I need to process, read the path to the file that I want to process:

#get current working directory; let's say it returns:

$path = "/export/home/mars-stats/device/config/2000/0825/blah/blah/blah.txt"


Then create the rule:


if while reading $path, you  encounter:

begins with "/", followed by 1 or more "/", then one or more word characters, then a "1" or 
a "2" followed by more than one digit, followed by one or more word characters
until the end of the line, grab the string between the first word 
character preceding a digit and the next word character,and replace the "/" with "."
this should return "2000.0825" which I could use to append to my new file. This rule, if I can figure out the syntax, would cover any input file created in between the years 1900 - 2999. Not bad mileage! Am I missing something here? Be gentle; this is the first program I've ever written in ANY language!

In reply to Re: Parsing File Timestamp? by Limo
in thread Parsing File Timestamp? by Limo

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.