Properly extract the foldername