How to rename a long list of photo filenames?

Dragos Neagu dragos.neagu at gmail.com
Fri Nov 18 01:48:26 MST 2005


On 11/10/05, der.hans <PLUGd at lufthans.com> wrote:
> Am 09. Nov, 2005 schwätzte Bill Jonas so:
>
> > On Tue, Nov 08, 2005 at 06:25:41PM -0700, Josef Lowder wrote:
> >> I've been making a shell script like this to rename them,
> >> but even doing this in a text editor, editing one line at a time,
> >> gets tedious:
> >>
> >> mv pict0001.jpg a001.jpg
> >> mv pict0002.jpg a002.jpg
> >> mv pict0003.jpg a003.jpg
> >
> > for file in pict*.jpg; do mv $file ${file//pict/a/}; done
---
> Thanks for demonstrating ${parameter/pattern/string} for us! I'm gonna
> have to start using that...

Thanks guys, I used that to help me transcode some video's and rename them.

for file in Numb3rs*.avi; do transcode -x mplayer -i $file -Z 320x180
-o ${file/.avi/-n.avi} -y xvid4; done
--
-Dragos Neagu <><
"If I have been able to see farther, it was only because I stood on
the shoulders of giants." - Sir Isaac Newton
"Open source is like science, closed source is like witchcraft" - Linus Torvalds


More information about the PLUG-discuss mailing list