recursion directory and weight.cpp