[NTLUG:Discuss] best/quickest to rename bunch files
David Camm
dcamm at advwebsys.com
Sat Nov 23 08:16:14 CST 2002
first, you write a little perl script - let's call it changename.pl:
#!/usr/bin/perl -n
chop;
($newname = $_) =~ s/JPG/jpg/;
rename ($_,$newname);
1;
the -n is important (see the camel book)....
then you do:
find . -name '*.JPG' -print | changename.pl
your second case is a bit more complicated, but generating the value of
$newname takes at most a few perl statements.
no guarantees expressed or implied <G>.
david camm
advanced web systems
m m wrote:
>
> All:
>
> Is there any best/quickest to rename cunch files?
> I have files with extension name .JPG (upper case), I want to rename to .jpg
> (lower case).
> I also want to rename files and keep the same secquence number, For example:
> aaBB001.jpg, aaBB002.jpg aaBB004.jpg after fename
> sAAbb001.jpg, sAAbb002.jpg, sAAbb004.jpg,
> the name changes, the "number" keep the same, which have no xxxx003.jpg
>
> anyone have suggestion?
>
> Thanks
>
> _________________________________________________________________
> Tired of spam? Get advanced junk mail protection with MSN 8.
> http://join.msn.com/?page=features/junkmail
>
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss
More information about the Discuss
mailing list