How To Rename a File in a loop

Hi All,

I am getting all .txt files from a particular directory, as in a following example:

for FILE in `echo $v_filename`
do
done

here i need to rename each original file with a new name for e.g.
we have 3 files in test directory
/test
a.txt
b.txt
c.txt

These files are in a loop so when i get first file say a.txt,
i need to rename it to a09142007.txt and continue. But for some text processing i need this file in same loop. I am getting error that file does not exists.. Please help

Thanks
sandeep

for FILE in $v_filename

Either way, it will fail if your filenames contain spaces or other pathological characters. You should use:

for FILE in *.txt

It is not clear what you mean; please post the script you have tried, along with the exact error messages it gives.

Once you have renamed a.txt to a09142007.txt, you will not find the file a.txt for next processing, will you ?

instead of moving the file a.txt to a09142007.txt , copy it and then do your next processing with a.txt and remove it at the end.

Hope i am clear. If you need further help , please post your script.

All,

Thanks for your replies.

Based on

"Once you have renamed a.txt to a09142007.txt, you will not find the file a.txt for next processing, will you ? "

I have resolved this problem by renaming a file at the end of loop after
completion of other processings.

Thanks
Sandeep