Rename a lot of files using shells script

Hi

This is the list file that i have :

The files is more than this.
I will rename one by one file become like this :

So just change the time stamp 200906 become 200905.
Is it possible using script ?

Thanks

There should be a better soln.

ls *2009* |while read file
do
   nf=$(echo $file|sed 's/200906/200905/')
   mv $file $nf
done

Or use posixshell (ksh, bash,...) builtin replace without external sed.

for file in *200906*
do
    nf=${file/200906/200905} 
    # example how to check, have we done some change or not - if done, then rename
    [ "$nf" != "$file" ] && mv "$file" "$nf"
done

Try this...

ls -1 *200906* | sed 's/\(.*\)\(200906\)\(.*\)/mv & \1200905\3/'

if it gives u what u want...

ls -1 *200906* | sed 's/\(.*\)\(200906\)\(.*\)/mv & \1200905\3/' | sh