[NBLUG/talk] perl script to rename file with a julian date

Andru Luvisi luvisi at andru.sonoma.edu
Tue Feb 3 16:12:01 PST 2004


On Tue, 3 Feb 2004, Dave Cooper wrote:
[snip]
> everynight @ 2000 I need to rename the files with the julian date as the
> extension....
[snip]

Personally, I prefer normal dates, since they are easier to read when
looking through a directory listing:

  use POSIX;
  print strftime("%Y-%m-%d-%H-%M-%S", localtime()), "\n";

...but you can use Time::JulianDay

  use Time::JulianDay;
  print local_julian_day(time()), "\n";

Stir in a call to rename() and season to taste.

Andru
-- 
Andru Luvisi




Quote Of The Moment:
  Great spirits have always encountered violent opposition from
  mediocre minds.
                  -- Albert Einstein
  
  They laughed at Einstein.  They laughed at the Wright Brothers.
  But they also laughed at Bozo the Clown.
                  -- Carl Sagan




More information about the talk mailing list