change dir to pattern