Index: TOOLS/PACK_IPSL/archive_debug.sh
===================================================================
--- TOOLS/PACK_IPSL/archive_debug.sh	(revision 1728)
+++ TOOLS/PACK_IPSL/archive_debug.sh	(revision 1728)
@@ -0,0 +1,159 @@
+#!/bin/bash
+
+
+#on veut archiver les fichiers Debug. 
+#Ils seront tous regroupes dans un repertoire DEBUG commun  
+# on les renommes (repertoire DEBUG) de la meme maniere que les fichiers restart
+# puis on les archive via tar par periode 
+#Creation des listes dans un repertoire debug_tar
+
+config_card=${1}
+LISTE_DMNFS=${2}
+
+
+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 "Demarrage de ${SCRIPT_NAME}"
+
+
+#### 0- lecture de config.card 
+#### on veut les renseignements suivants : 
+#### JobName, PATH_SIMUL, DateBegin et DateEnd
+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})
+
+
+#### Preparation de l'environnement
+# repertoire dans lequel seront renommes les fichiers de debug
+STORE_DEBUG=$IGCM_DEM_SIMU/DEBUG
+mkdir -p ${STORE_DEBUG}
+
+# repertoire dans lequel nous stockerons les listes de debug a archiver
+DEBUG_TAR=$IGCM_DEM_SIMU/debug_tar
+mkdir -p ${DEBUG_TAR}
+
+# lecture de periodpack dans ${IGCM_DEM_SIMU}/period_pack.txt
+period_pack=`awk '{print $0} ' ${IGCM_DEM_SIMU}/period_pack.txt`
+
+#### 1- renommer les fichiers ######
+DEM_log -1 "Renommer les fichiers de Debug"
+
+cd ${STORE_DEBUG}
+rm -rf *
+
+# On les copie sur le scratchdir en changeant le nom et conservant la date
+grep ${PATH_SIMUL_FULL} ${LISTE_DMNFS} | grep Debug | awk '{print $3}' | sed '/^.*Debug$/d' >> ${IGCM_DEM_SIMU}/liste_debug_files.txt
+
+
+#awk -F/ '{dest_name=$(NF-2)("_") $(NF);
+#   system("cp --preserve " $0 " "dest_name)}' ${IGCM_DEM_SIMU}/liste_debug_files.txt
+  
+gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${IGCM_DEM_SIMU}/liste_debug_files.txt
+
+ls -l ${STORE_DEBUG} > ${IGCM_DEM_SIMU}/new_liste_debug_files.txt
+
+### 2- creer les listes de fichiers par periode ####
+DEM_log -1 "Creation des listes de fichiers par periode"
+### 2.1- extraire l'annee et le mois de DateBegin ###
+date_begin=${DateBegin}
+date_end=${DateEnd}
+
+year_begin=$(echo ${date_begin} | cut -c 1-4 )
+month_begin=$(echo ${date_begin} | cut -c 5-6 )
+year_end=$(echo ${date_end} | cut -c 1-4 )
+month_end=$(echo ${date_end} | cut -c 5-6 )
+
+
+### 2.2- creation des listes ###
+date_begin_pack=${date_begin}
+date_end_simulation=${date_end}
+
+month_begin_pack=${month_begin}
+year_begin_pack=${year_begin}
+
+number_pack=1
+
+while [ ${date_begin_pack} -le ${date_end_simulation} ]
+do 
+
+DEM_log -1 "On calcule la date de fin du pack "
+
+   month_end_pack=${month_begin_pack}
+   year_end_pack=`expr ${year_begin_pack} + ${period_pack}`
+
+   if [ ${month_end_pack} -le 9 ] 
+   then 
+      date_end_pack=${year_end_pack}0${month_end_pack}01
+   fi 
+   if [ ${month_end_pack} -gt 9 ] 
+   then 
+      date_end_pack=${year_end_pack}${month_end_pack}01   
+   fi 
+
+  
+   for file in `awk '{print $9}' ${IGCM_DEM_SIMU}/new_liste_debug_files.txt`; do 
+   
+     extract_date_file=`echo ${file}  | sed -e "s/.*\${JobName}_//"`
+     date_file=`echo ${extract_date_file}| sed 's/\([0-9]\{8\}\)_.*$/\1/g'`
+
+
+     if [  ${date_file} -lt ${date_end_pack} ]
+     then 
+        if [ ${date_file} -ge ${date_begin_pack} ]
+        then 
+           echo ${file} >> ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt
+        fi
+     fi
+   
+   done
+
+#on archive les debug - le nom de l'archive contiendra ${yearbegin}${monthbegin}_${yearend}${monthend} 
+# end etant la date du dernier fichier contenu et non pas la premiere date suivant 
+DEM_log -1 "Recherche de la date de fin reel pour nommer l'archive "
+#On classe par ordre alphabetique les fichiers contenus dans liste_pack_debug 
+#la date du dernier fichier donnera la date de fin du pack
+   sort ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt > ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt.tmp
+   last_file=$(tail -n 1 ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt.tmp )
+   extract_date_file=$( echo ${last_file}  | sed -e "s/.*${JobName}_//" )
+   DateEnd_Debug=$(   echo ${extract_date_file}| sed 's/\([0-9]\{8\}\)_.*$/\1/g' )
+   mv ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt.tmp ${DEBUG_TAR}/tar_debug_${date_begin_pack}_${DateEnd_Debug}.list
+
+
+DEM_log -1 "Passage de la commande Tar pour archiver la liste creee"
+#   tar -cf ${JobName}_${date_begin_pack}_${DateEnd_Debug}_debug.tar --dereference  --files-from ${DEBUG_TAR}/tar_debug_${date_begin_pack}_${DateEnd_Debug}.list
+#   cat  ${DEBUG_TAR}/tar_debug_${number_pack}.list | xargs rm 
+
+
+DEM_log -1 "On defini le datebegin de la  prochaine periode pack"
+#on defini la periode pack suivante
+   month_begin_pack=${month_end_pack}
+   year_begin_pack=${year_end_pack}
+
+   if [ ${month_begin_pack} -le 9 ]
+   then 
+      date_begin_pack=${year_begin_pack}0${month_begin_pack}01
+   fi 
+   if [ ${month_begin_pack} -gt 9 ]
+   then 
+      date_begin_pack=${year_begin_pack}${month_begin_pack}01
+   fi 
+
+
+   number_pack=`expr ${number_pack} + 1`
+
+done
+
+
+cd ${EXE_DIR}
Index: TOOLS/PACK_IPSL/archive_restart.sh
===================================================================
--- TOOLS/PACK_IPSL/archive_restart.sh	(revision 1727)
+++ TOOLS/PACK_IPSL/archive_restart.sh	(revision 1728)
@@ -54,7 +54,11 @@
 
 #### Preparation de l'environnement
-# repertoire dans lequel seront crees les archives
-STORE_RESTART=$IGCM_DEM_SIMU/Restart
+# repertoire dans lequel seront renommes les fichiers de restart
+STORE_RESTART=$IGCM_DEM_SIMU/RESTART
 mkdir -p ${STORE_RESTART}
+
+# repertoire dans lequel nous stockerons les listes de restart a archiver
+RESTART_TAR=$IGCM_DEM_SIMU/restart_tar
+mkdir -p ${RESTART_TAR}
 
 # lecture de periodpack dans ${IGCM_DEM_SIMU}/period_pack.txt
@@ -123,5 +127,4 @@
 
 
-     echo pack nÂ°${number_pack}  ${date_file} ${date_begin_pack} ${date_end_pack} 
      if [  ${date_file} -lt ${date_end_pack} ]
      then 
@@ -142,13 +145,11 @@
    last_file=$(tail -n 1 ${IGCM_TMP}/${$}.liste_pack_restart_${number_pack}.txt.tmp )
    extract_date_file=$( echo ${last_file}  | sed -e "s/.*${JobName}_//" )
-   echo ${extract_date_file}
    DateEnd_Restart=$(   echo ${extract_date_file}| sed 's/\([0-9]\{8\}\)_.*$/\1/g' )
-   echo ${DateEnd_Restart}
-   mv ${IGCM_TMP}/${$}.liste_pack_restart_${number_pack}.txt.tmp ${IGCM_DEM_SIMU}/liste_pack_restart_${date_begin_pack}_${DateEnd_Restart}.txt
+   mv ${IGCM_TMP}/${$}.liste_pack_restart_${number_pack}.txt.tmp ${RESTART_TAR}/tar_restart_${date_begin_pack}_${DateEnd_Restart}.list
 
 
 DEM_log -1 "Passage de la commande Tar pour archiver la liste creee"
-   tar -cf ${JobName}_${date_begin_pack}_${DateEnd_Restart}_restart.tar --dereference  --files-from ${IGCM_DEM_SIMU}/liste_pack_restart_${date_begin_pack}_${DateEnd_Restart}.txt
-#   cat  ${IGCM_DEM_SIMU}/liste_pack_restart_${number_pack}.txt | xargs rm 
+#   tar -cf ${JobName}_${date_begin_pack}_${DateEnd_Restart}_restart.tar --dereference  --files-from ${RESTART_TAR}/tar_restart_${date_begin_pack}_${DateEnd_Restart}.list
+#   cat  ${RESTART_TAR}/tar_restart_${number_pack}.list | xargs rm 
 
 
@@ -173,3 +174,3 @@
 
 
-
+cd ${EXE_DIR}
Index: TOOLS/PACK_IPSL/create_config_card.sh
===================================================================
--- TOOLS/PACK_IPSL/create_config_card.sh	(revision 1727)
+++ TOOLS/PACK_IPSL/create_config_card.sh	(revision 1728)
@@ -99,10 +99,10 @@
 
     # Etablir la liste des fichiers d'Analyse
-    grep ${PATH_SIMUL_FULL}/ ${LISTE_DMNFS} | grep Analyse  | awk '{print $2 " "  $3}' |  sort >> ${STORE_CP}/liste_analyse_files.txt
+    grep ${PATH_SIMUL_FULL}/ ${LISTE_DMNFS} | grep Analyse  | awk '{print $2 " "  $3}' |  sort >> ${STORE_CP}/cp_analyse_files.list
 
 
     # Etablir la liste des fichiers Monito et Atlas
-    grep ${PATH_SIMUL_FULL}/ ${LISTE_DMNFS} | grep  MONITORING | awk '{print $2 " "  $3}' | sort >> ${WORK_CP}/liste_monito_files.txt
-    grep ${PATH_SIMUL_FULL}/ ${LISTE_DMNFS} | grep  ATLAS | awk '{print $2 " "  $3}' | sort >> ${WORK_CP}/liste_atlas_files.txt
+    grep ${PATH_SIMUL_FULL}/ ${LISTE_DMNFS} | grep  MONITORING | awk '{print $2 " "  $3}' | sort >> ${WORK_CP}/cp_monito_files.list
+    grep ${PATH_SIMUL_FULL}/ ${LISTE_DMNFS} | grep  ATLAS | awk '{print $2 " "  $3}' | sort >> ${WORK_CP}/cp_atlas_files.list
     
 
@@ -121,5 +121,5 @@
 # Sauvegarde des fichiers qui ne sont pas dans la norme
     cat ${IGCM_TMP}/${$}.info_tmp_bis.txt >> ${IGCM_TMP}/${$}.liste_no_restart_files_config.txt
-    mv ${IGCM_TMP}/${$}.liste_no_restart_files_config.txt ${OTHER_TAR}/tar_no_restart_files.txt
+    mv ${IGCM_TMP}/${$}.liste_no_restart_files_config.txt ${OTHER_TAR}/tar_no_restart_files.list
 
 
@@ -131,5 +131,5 @@
 # Sauvegarde des fichiers qui ne sont pas dans la norme
     cat ${IGCM_TMP}/${$}.info_tmp_bis.txt >> ${IGCM_TMP}/${$}.liste_no_output_files_config.txt
-    mv ${IGCM_TMP}/${$}.liste_no_output_files_config.txt ${OTHER_TAR}/tar_no_output_files.txt
+    mv ${IGCM_TMP}/${$}.liste_no_output_files_config.txt ${OTHER_TAR}/tar_no_output_files.list
 
 
@@ -187,10 +187,10 @@
 
 # si les listes no_output et no_restart sont vides on les efface
-if [[ !  -s ${OTHER_TAR}/tar_no_output_files.txt ]]; then 
-    rm -f ${OTHER_TAR}/tar_no_output_files.txt
+if [[ !  -s ${OTHER_TAR}/tar_no_output_files.list ]]; then 
+    rm -f ${OTHER_TAR}/tar_no_output_files.list
 fi 
 
-if [[ !  -s ${OTHER_TAR}/tar_no_restart_files.txt ]]; then 
-    rm -f ${OTHER_TAR}/tar_no_restart_files.txt
+if [[ !  -s ${OTHER_TAR}/tar_no_restart_files.list ]]; then 
+    rm -f ${OTHER_TAR}/tar_no_restart_files.list
 fi 
 
Index: TOOLS/PACK_IPSL/launch_ipsl_pack.sh
===================================================================
--- TOOLS/PACK_IPSL/launch_ipsl_pack.sh	(revision 1727)
+++ TOOLS/PACK_IPSL/launch_ipsl_pack.sh	(revision 1728)
@@ -79,5 +79,6 @@
 	${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}
+	${EXE_DIR}/archive_restart.sh ${CONFIG} ${LISTE_DMNFS}
+	${EXE_DIR}/archive_debug.sh ${CONFIG} ${LISTE_DMNFS}
 
     fi
Index: TOOLS/PACK_IPSL/write_liste_pack.sh
===================================================================
--- TOOLS/PACK_IPSL/write_liste_pack.sh	(revision 1727)
+++ TOOLS/PACK_IPSL/write_liste_pack.sh	(revision 1728)
@@ -52,6 +52,6 @@
 
 # creation des repertoires with_tar et with_ncrcat
-OUTPUT_NCRCAT=${IGCM_DEM_SIMU}/with_ncrcat
-OUTPUT_TAR=${IGCM_DEM_SIMU}/with_tar
+OUTPUT_NCRCAT=${IGCM_DEM_SIMU}/output_ncrcat
+OUTPUT_TAR=${IGCM_DEM_SIMU}/output_tar
 
 mkdir -p ${OUTPUT_NCRCAT}
