Fix logic for metadata types with subfolders (i.e. reports and
dashboards)