This TML will copy a layer group and all the layers (that have members) into a new layer group where the group and each layer is named the existing name with a prefix (or suffix). Just select the layer group and enter a layer/group prefix.
I have updated the macro to allow the "prefix" text to be place after the layer or layer group name. Just enter the "^" character for the first character in the name and the layer name will be first with the new text appended. So if "^-P2" entered for prefix text, the layer group would be named "old-name-P2"
There is also a checkbox to allow "replacing" the prefix text. In this case, the same number of characters contained in the prefix will be removed from the existing name. So if you wanted to copy a layer group named "P2-Road intersection line" to a group named "P3-Road intersection line", just enter "P3" for prefix and select the replace option. Note, this applies to all the newly created layer too.
The new layer group name is now displayed in the Textbox so it can be checked before pressing the "Ok" button.
After running cmd, the view filter will show the new group and all the layers.