The following bash script renames all the files matching src_name.* with dst_name.*:
src_name=$1 dst_name=$2 unset $1 cp $src_name.* ~/temp/ cd ~/temp/ rename "s/$src_name\.([a-z]+)/$dst_name\.\$1/" * cd - mv ~/temp/$dst_name.* .
If you have some files like src1.h and src1.cpp, you can save this script into dupsource.sh file, for example, and then rename those files with src2.h and src2.cpp using the following command:
dupsource.sh src1 src2
The script requires ~/temp directory to exist and be writable.