Eliminate duplication in directory copies and fix broken test.