Bulk renaming armature bones after already creating them? I'm trying to create an animation rig with quite a few armature bones. I'm modeling a bug, which has a total of 14 legs, and each one of those legs has 5 armature bones. The legs are identical, except they are in different positions with different rotations, so to set up the armatures I simply created an armature for one leg and duplicated it to the other legs, rotating and repositioning it as needed. However, I named the front legs FrontLeg.L and FrontLeg.R. The other legs, since they're just duplicated, are, for example, FrontLeg.R.007, etc etc. I can easily rename the parent bone for each leg, but this becomes tedious very quickly to do this for all of the children as well.

Is there any easy way for me to rename the parent bone to, for example, 2ndFrontLeg.L and have all of the children automatically be assigned names 2ndFrontLeg.L.001, 2ndFrontLeg.L.002, etc, after they've already been created? I'm completely ok with using addons as well
Open a text editor in Blender and paste the code below there.
Replace the text in "original" and "replacement" as needed.
Go to pose mode and select the parent of the new chain.
Press "Run Script" in the text editor.


Here's the code:

import bpy
original    = "FrontLeg"    # Original name that was duplicated to generate all legs
replacement = "2ndFrontLeg" # The new name you want for this particular leg's bone chain

parent = bpy.context.active_pose_bone
for b in [ parent ] + parent.children_recursive:
    b.name = replacement