sort based on path