Re: File renaming command or script?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Jerry Davis
Date:  
To: plug-discuss
New-Topics: Solved! Re: File renaming command or script?
Subject: Re: File renaming command or script?
On Tuesday 16 November 2004 09:26 pm, Alan Dayley wrote:

this is crude but it works:

#!/usr/bin/env perl

my @fromfiles = <*.JPG>;
my @tofiles = <*.JPG>;

my $n = 1;
my $n3;

foreach (@tofiles) {
/.*_(.*)\.JPG/;
$n3 = sprintf "%3.3d", ($n);
s/$+/$n3/;
$n++;
}

for(my $n=0; $n<$#fromfiles; $n++) {
system "mv $fromfiles[$n] $tofiles[$n]\n";
}

--
Registered Linux User: 275424
Today's Fortune: Life's the same, except for the shoes.
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss