Hello - I have been trying to use perl to change filenames this morning, and
have been having a lot of luck, but have hit a stopping point. I have
lwall's code:

#!/usr/local/bin/perl
#
# Usage: rename perlexpr [files]

($regexp = shift @ARGV) || die "Usage:  rename perlexpr [filenames]\n";

if (!@ARGV) {
   @ARGV = <STDIN>;
   chomp(@ARGV);}

foreach $_ (@ARGV) {
   $old_name = $_;
   eval $regexp;
   die $@ if $@;
   rename($old_name, $_) unless $old_name eq $_;
}

exit(0);

but I want to be able to rename a file name from one number series to
another number series ie:

Image1.jpg
Image2.jpg
Image3.jpg
....

to

Foo234.jpg
Foo235.jpg
Foo236.jpg
....

Is there a way to do this using regular expressions? Is there a more elegant
way to adding a counter to the script above and hard-code the argument?

Thanks for any help,

tim

____________________________________________________
Timothy B Booher, Lt USAF, AFRL/MNAC
101 West Eglin Blvd, Suite 339 
Eglin AFB FL 32542-6810 
Phone: 850-882-8302 Ext. 3360 (DSN 872-)
FAX: 850-882-2201

 -----Original Message-----
From:   COLLINEAU Franck FTRD/DMI/TAM
[mailto:[EMAIL PROTECTED]] 
Sent:   Monday, December 10, 2001 4:08 AM
To:     '[EMAIL PROTECTED]'
Subject:        Stat function

Greetings,

I have the following code:

opendir (INFO,"l:/01_informatique") || die " impossible  d'ouvrire le
répertoire 01_informatique: $!";

while ($fic=readdir INFO)
{
        if($fic=~/^c/)
        {
                @date=stat($fic);
                print "$date[7]\n";
        }
}
close INFO;


There is nothing in the screen !

Best regards,

Franck

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

Reply via email to