Replace dir with keep.