Modified copytree.cpp.