Index: /TOOLS/PACK_IPSL/calcul_size_simul.sh
===================================================================
--- /TOOLS/PACK_IPSL/calcul_size_simul.sh	(revision 1713)
+++ /TOOLS/PACK_IPSL/calcul_size_simul.sh	(revision 1714)
@@ -14,4 +14,9 @@
 mkdir -p ${IGCM_TMP}
 
+EXE_DIR=$(dirname ${0})
+SCRIPT_NAME=$(basename ${0} )
+source ${EXE_DIR}/DEM_utilities.sh
+DEM_log -0 "Demarrage de ${SCRIPT_NAME}"
+
 eval $(grep JobName ${config_card}) 
 eval $(grep PATH_SIMUL_FULL ${config_card}) 
@@ -26,16 +31,16 @@
 
 #cree la liste de l'ensemble des fichiers de la simulation
-grep ${PATH_SIMUL_FULL} ${LISTE_DMNFS} | grep 'R ' > ${IGCM_TMP}/$$.info_tmp.txt 
-awk '{print $(NF-2) " " $(NF-1)}' ${IGCM_TMP}/$$.info_tmp.txt > ${IGCM_DEM_SIMU}/All_files_simul.txt
+#echo ${PATH_SIMUL_FULL} ${LISTE_DMNFS}
+grep ${PATH_SIMUL_FULL} ${LISTE_DMNFS} | grep 'f ' > ${IGCM_TMP}/$$.info_tmp.txt 
+awk '{print $(NF-1) " " $(NF)}' ${IGCM_TMP}/$$.info_tmp.txt > ${IGCM_DEM_SIMU}/All_files_simul.txt
 
 size=`awk 'BEGIN {y = 0} {x = $1 ; y = y + x } END{print y}'  ${IGCM_DEM_SIMU}/All_files_simul.txt`
-echo $size
+DEM_log -3 "la taille de la simulation est  $size"
 if [  ${size} -lt ${limitmin} ]
 then
 
-    echo "trop petit on archive cette simulation avec tar"
-    PATH_SIMUL_SHORT=$(echo ${PATH_SIMUL_FULL} | sed 's%/[^/]*/[^/]*/[^/]*/%%' )
-    echo  ${PATH_SIMUL_FULL} > ${IGCM_DEM_SIMU}/tar_full_simul.txt
-
+    DEM_log -0  "Simulation < 1Go -  on l'archive avec tar"
+    ./write_liste_tar.sh ${config_card}
 
 fi
+DEM_log -0 "Fin de ${SCRIPT_NAME}"
Index: /TOOLS/PACK_IPSL/launch_ipsl_pack.sh
===================================================================
--- /TOOLS/PACK_IPSL/launch_ipsl_pack.sh	(revision 1713)
+++ /TOOLS/PACK_IPSL/launch_ipsl_pack.sh	(revision 1714)
@@ -68,15 +68,17 @@
 for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do 
     
-    DEM_log ${CONFIG}
+    DEM_log -2 ${CONFIG}
 
     eval $(grep IGCM_DEM_SIMU ${CONFIG})
     ${EXE_DIR}/calcul_size_simul.sh ${CONFIG} ${LISTE_DMNFS}
 
-    if [ ! -f ${IGCM_DEM_SIMU}/tar_full_simul.txt ]
-    then 
-	echo "la simulation est superieur a 1Go alors on pack"
+    DEM_state=$( DEM_read_state ${IGCM_DEM}/config_card.liste ${CONFIG} )
+    if [[ "${DEM_state}" != "WriteListTarDone" ]] ; then
+
+	DEM_log -3  "la simulation est superieur a 1Go alors on pack"
 	${EXE_DIR}/find_size_pack.sh   ${CONFIG} ${LISTE_DMNFS}
 	${EXE_DIR}/write_liste_pack.sh ${CONFIG} ${LISTE_DMNFS}
 #	${EXE_DIR}/archive_restart.sh ${CONFIG} ${LISTE_DMNFS}
+
     fi
 done
Index: /TOOLS/PACK_IPSL/write_liste_tar.sh
===================================================================
--- /TOOLS/PACK_IPSL/write_liste_tar.sh	(revision 1714)
+++ /TOOLS/PACK_IPSL/write_liste_tar.sh	(revision 1714)
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+#On decide d'archiver via tar une simulation entiere : 
+# - si elle est trop petite 
+# - si elle ne contient aucun fichier d'output correspondant a la norme etablie JobName_date 
+
+
+config_card=${1}
+
+# Declaration des variables
+
+# ----
+export JOB_DIR=${JOB_DIR:-${PWD}}
+export IGCM_DEM=${IGCM_DEM:-${SCRATCHDIR}/IGCM_DEM}
+export IGCM_TMP=${IGCM_TMP:-${IGCM_DEM}/tmp}
+mkdir -p ${IGCM_DEM}
+mkdir -p ${IGCM_TMP}
+clean_tmp=${clean_tmp:-yes}
+EXE_DIR=$(dirname ${0} )
+SCRIPT_NAME=$(basename ${0} )
+source ${EXE_DIR}/DEM_utilities.sh
+DEM_log -0 "Demmarrage de ${SCRIPT_NAME}"
+cd ${JOB_DIR}
+# ----
+DEM_log -0 "Debut de ${SCRIPT_NAME}"
+DEM_log -0 "On va archiver via tar la simulation " ${PATH_SIMUL_FULL}
+DEM_log -0 "config_card : ${config_card}"
+
+eval $(grep JobName         ${config_card}) 
+eval $(grep PATH_SIMUL_FULL ${config_card}) 
+eval $(grep DateBegin       ${config_card}) 
+eval $(grep DateEnd         ${config_card}) 
+eval $(grep IGCM_DEM_SIMU   ${config_card})
+
+
+echo  ${PATH_SIMUL_FULL} > ${IGCM_DEM_SIMU}/tar_full_simul.txt
+
+# Dans ce cas la on efface les eventuelles listes deja creees
+rm -f ${IGCM_DEM_SIMU}/tar_no_output_files.txt
+rm -f ${IGCM_DEM_SIMU}/tar_no_restart_files.txt
+
+DEM_write_state ${IGCM_DEM}/config_card.liste ${config_card} WriteListTarDone
+
+DEM_log -0 "Fin de ${SCRIPT_NAME}"
