Re: Solved! 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
Subject: Re: Solved! Re: File renaming command or script?
On Tuesday 16 November 2004 11:11 pm, Alan Dayley wrote:
> On Tuesday 16 November 2004 09:17 pm, Jerry Davis 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++) {


put an equal sign in there instead:
for(my $n=0; $n<=$#fromfiles; $n++) {

> > system "mv $fromfiles[$n] $tofiles[$n]\n";
> > }
>
> It did work! Mostly. The last file did not get renamed but I handled that
> manually.
>
> Thank you. I did not relish the idea of manually renaming a boatload of
> files.
>
> Alan
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


-- 
Registered Linux User: 275424
Today's Fortune: Truth is the most valuable thing we have -- so let us 
economize it.
        -- Mark Twain
---------------------------------------------------
PLUG-discuss mailing list - 
To subscribe, unsubscribe, or to change  you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss