Please bottom post....

> 
> thanks. I wasn't aware of the rename function. As far as converting to
YYYYMMDD, can that be done on the fly using localtime()? I am reading
online docs now, but nothing talks about it done on the fly i.e. when I
call the function up. If not I will work on it some more and follow up
with whatever I find out.
>  
> Regards.
> 

'localtime' will only provide you the pieces to build the date, from
there you will likely want to build a filename string.  'sprintf' may be
of assistance in this case for getting two digit months and days,

perldoc -f sprintf

For more.  Be sure to check the perldocs for information about
converting the parts of the date returned by localtime to actual format,
for instance adjusting the month by 1 and the year by 1900...

perldoc POSIX specifically the 'strftime' might also prove useful,
though is more complicated.

HTH,

http://danconia.org

> 
> Wiggins d Anconia <[EMAIL PROTECTED]> wrote:
> 
> 
> > jason corbett wrote:
> > > How can i rename a file or create a file with the date included? For
> > > example, I want to automate and run reports and save the reports
> > > under the date of when they were created i.e. JC07082004. Whats the
> > > easiest way to do this? 
> > > 
> > > Thanks,
> > > JC
> > 
> > Using localtime in conjunction with time, you can roll your own
> little setup. 
> > 
> 
> Additionally, if you didn't know already, Perl has a 'rename' function
> built in, or if you are going to g across file system boundaries you
> should look at the File::Copy module.
> 
> perldoc -f rename
> perldoc -f time
> perldoc -f localtime
> perldoc File::Copy
> 
> Additionally you might consider using the Compress::Zlib for compression
> of the logs, and you should definitely consider changing your naming
> convention to be YYYYMMDD as that will allow the files to sort properly
> in their directory.
> 
> http://danconia.org
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to