construct directory tree