recursively loop through directory structure