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

Bill Kendrick nbs at sonic.net
Tue Feb 3 16:00:04 PST 2004


On Tue, Feb 03, 2004 at 03:46:10PM -0800, Dave Cooper wrote:
> Well I've been playing around, with no success...
> 
> I have 2 files in a /dir
> 
> fileA.rpt and fileB.rpt
> 
> everynight @ 2000 I need to rename the files with the julian date as the 
> extension....
> 
> Trying to stay with perl...

BASH could do it for you easily, I think:

  mv fileA.rpt fileA-`date +%Y%m%d`.rpt

would, today, be the same as:

  mv fileA.rpt fileA-20040203.rpt

(for Feb 3 2004)

-bill!



More information about the talk mailing list