only prefix match for directories, otherwise exact match