On Fri, 8 Feb 2002 06:48:56 -0800, Troy May <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> 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
> 
> Any ideas on this?  He's really bugging me about it.  :)

#!/usr/bin/perl -w
use strict;

my $file = 'message.dat';
my ($d,$m,$y)=(localtime)[3,4,5];
my $newname = sprintf('mess%02i%02i%02i.html', $d, ++$m, ($y+1900)%100);

print "$file => $newname\n";
rename($file, $newname) 
        or warn "Could not rename '$file' to '$newname': $!\n";

__END__


-- 
briac
 << dynamic .sig on strike, we apologize for the inconvenience >>


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

Reply via email to