read directory structure into array