FIX don't shell out when you can mv or rmdir

fixes #7041, and a couple of other places where there is unnecessary shelling out.