compare file and decide how to operate it