Rename multiple files lesson

Hi All,

So I found a cool way to change extensions to multiple files with:

for i in *.doc
do
mv $i ${i%.doc}.txt
done

However, what I want to do is move *.txt to *_0hr.txt but the following doesn't work:

for i in *.txt
do
mv $i ${i%.txt}_0hr.txt
done

My questions are (1) Why doesn't it work? (2) How can it be altered to work?

Cheers,
ScKaSx

Because your traversing *.doc files in your loop where you should be traversing *.txt files.

Nevermind, it works! I'm a dumbass.