in reply to Parsing File Timestamp?
/export/home/mars-stats/device/config/2000/0825/blah/blah/blah.txtYour 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!
|
|---|