Recursively converts directory contents to flat object.