Parse the folder name correctly in case it ends with /