To move all children recursively:
groovy:
def confB = system.configurationManager.get("A/B");
def confB_1 = system.configurationManager.get("A/B_1");
if (confB_1 != null) { // it already exists, so we move all its children
for (eachChild in system.configurationManager.getChildren(confB)) {
eachChild.setParent(confB_1);
system.configurationManager.save(eachChild);
}
} else { // otherwise rename B as B_1 (all children under B will be automatically under B_1 after the renaming)
confB.setName("B_1");
system.configurationManager.save(confB);
}
When changing the parent configuration, it is actually a move, the copy from old place will disappear. As to workspace setting, you normally does not need to do that, as workspace setting is generally using the configuration id instead of name (even if you are using the name, you should script it to use ${configuration.name} instead of hard-code it).