-1

This question already has an answer here:

How to rename a group of files

tl_0014_0010_20151212_133443.jpg
tl_0014_0010_20151212_133543.jpg
tl_0014_0010_20151212_133643.jpg
...

to

photo00000.jpg
photo00001.jpg
photo00002.jpg
...

?

marked as duplicate by slm Dec 12 '15 at 14:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

To get you started:

i=0
for file in tl*.jpg
do
    printf -v counter "%05d" $i
    mv $file photo$counter.jpg
    i=$((i+1))
done

The printf command ensures the counter has leading zeroes.

Note that I didn't test this.

  • The -v option to printf is a shell extension that's not supported in most Bourne shells. A more portable method is counter=$(printf "%05d" "$i"). – RobertL Dec 12 '15 at 14:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.