Solved! Re: File renaming command or script?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Alan Dayley
Date:  
To: plug-discuss
Old-Topics: Re: File renaming command or script?
Subject: Solved! Re: File renaming command or script?
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++) {
> 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