On Feb 8, Troy May said:

>I posted a question about this a couple days ago and only got 2 responses,
>but neither of them worked for him.  So I figured I'd start new since he
>told me the EXACT format he would like the files to be in.  My friend wants
>to rename a dat file as he calls it.  (message.dat?)  He would like to
>rename them in this exact format:  the word "mess", current date (2
>character format) then the extension .html.  So if he would run this today,
>the renamed file would be:  mess020802.html

You'll want the rename() function, and you can get the parts of the date
you want from localtime() -- you'll be interested in (localtime)[3,4,5] to
get only the elements you wanted.  You'll use sprintf() to format them
("%02d" formats a number as a two-digit number with a leading zero if
needed).

That should be enough to start you on your way.  If you come up with some
code, and it doesn't work quite right, show it to us, and we'll see how we
can help.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to