Fix #15862 remove dirs in keep list when walk path