Change the name of a target and the directory containing its `main.cpp`.

Question 1. How do I change the name of a target once it's been created?

Question 2. I have a very simple example target, whose `main.cpp` is in a group. For simplicity, all of my groups correspond exactly with the directory structure.. How do I change the group's name (along with the name of the corresponding directory and of the corresponding target)? When I try to right-click the group and use refactor->rename, an error message appears that says "can't rename target's main group".