recursively iterate directories