Back up of multiple data files

I have filesi in a direcotry that start with different names but have dates in the format 01212006. Along with these files there are also files with different dates. What i want to do is copy all the files that have 01212006 in them to 01072007 and move the old files to different directory.

For e.g file of interest : abc.01212006.1.dat
file of no interest abc.01262006.1.dat

I need the file of interest to be copied to abc.01072007.1.dat and then move the old file to diffrerent directory. How can I acheive this?

Try...

#!/usr/bin/ksh

date="01212006"
newdate="01072007"

for file in *$date*
do
  [[ -f $file ]] || echo no files && exit 1
  newfile=$(echo $file|sed "s/$date/$newdate/")
  cp $file $newfile
  : etc
done