Cool! That one works great!

[EMAIL PROTECTED] wrote:

> > >You can't do this with regular batch files tools and I don't know of
any
> > tools
> > >out there to do that. You can do it with Perl or VBScript quite
easily.
> > Perl
> > >would use something like this:
> > >
> > >    perl -e'@d=localtime; rename $ARGV[0],
$ARGV[0].$d[5].$d[4].$d[3];'
> >
> > This command actually renames the file to access.log10108, with 101
being
> > the year, 0 being the month and 8 being the day. The Perl docs say that
the
> > year is number of years since 1900 and that months start at 0. So, I'm
> > looking through the docs to find out how to correct it to human
readable
> > format.
>
> Sorry, it was just off the top of my head. :) Try this (one line):
>
> perl -e'@d=localtime; rename $ARGV[0], "$ARGV[0]." . ($d[5]+1900) .
($d[4] + 1)
> .$d[3];'

This time it made it access.log.200118. I was wondering how to get that
extra "." in the filename! :)
I've actually put this into a ".pl" so it can be called from a batch file
as "perl test.pl access.log"

Here is what I have:
----------
@d = localtime;
rename $ARGV[0], "$ARGV[0]." . ($d[5]+1900) . ($d[4] + 1) .$d[3];
----------

Now, to get 2 digit month and day! Sorry to keep picking your brain about
this! :)

Michael


------------------------------------------------------------------------
This is the analog-help mailing list. To unsubscribe from this
mailing list, send mail to [EMAIL PROTECTED]
with "unsubscribe" in the main BODY OF THE MESSAGE.
List archived at http://www.mail-archive.com/[email protected]/
------------------------------------------------------------------------

Reply via email to