Fix recursively adding folders to a repository

Until now, subfolders of folders were added flatly. This change adds folders recursively and creates subfolders within the repository.