Index: TOOLS/PACK_IPSL/archive_debug.sh
===================================================================
--- TOOLS/PACK_IPSL/archive_debug.sh	(revision 1876)
+++ TOOLS/PACK_IPSL/archive_debug.sh	(revision 1878)
@@ -63,78 +63,85 @@
 grep ${PATH_SIMUL_FULL} ${LISTE_DMNFS} | grep Debug | awk '{print $3}' | sed '/^.*Debug$/d' >> ${IGCM_TMP}/${$}.liste_debug_files.txt
 
+# Test si il y a un repertoire Debug
+listDebugNbLines=`cat ${IGCM_TMP}/${$}.liste_debug_files.txt | wc -l `
+if [ "x${listDebugNbLines}" == "x0" ]
+then
+    DEM_log -0 "Pas de repertoire Debug pour cette simulation"
+else
+
 # cas particulier : les fichiers Bands sont conserves sans etre archives
-grep ${JobName}_Bands ${IGCM_TMP}/${$}.liste_debug_files.txt >> ${STORE_CP}/cp_files.list
-sed "/${JobName}_Bands/d" ${IGCM_TMP}/${$}.liste_debug_files.txt > ${IGCM_TMP}/${$}.liste_debug_files.txt_tmp
-mv ${IGCM_TMP}/${$}.liste_debug_files.txt_tmp ${IGCM_TMP}/${$}.liste_debug_files.txt
-  
-gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${IGCM_TMP}/${$}.liste_debug_files.txt
+    grep ${JobName}_Bands ${IGCM_TMP}/${$}.liste_debug_files.txt >> ${STORE_CP}/cp_files.list
+    sed "/${JobName}_Bands/d" ${IGCM_TMP}/${$}.liste_debug_files.txt > ${IGCM_TMP}/${$}.liste_debug_files.txt_tmp
+    mv ${IGCM_TMP}/${$}.liste_debug_files.txt_tmp ${IGCM_TMP}/${$}.liste_debug_files.txt
+    
+    gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${IGCM_TMP}/${$}.liste_debug_files.txt
 
 #on fait de meme avec les fichiers out_gcm.e stockes dans le repertoire Out/ qui seront prefixes par Out_
-rm -f ${IGCM_TMP}/${$}.liste_debug_files.txt
-grep ${PATH_SIMUL_FULL} ${LISTE_DMNFS} | grep -w Out | awk '{print $3}' | sed '/^.*Out$/d' > ${IGCM_TMP}/${$}.liste_debug_files.txt
-gawk -F/ '{dest_name=$(NF-1)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${IGCM_TMP}/${$}.liste_debug_files.txt
+    rm -f ${IGCM_TMP}/${$}.liste_debug_files.txt
+    grep ${PATH_SIMUL_FULL} ${LISTE_DMNFS} | grep -w Out | awk '{print $3}' | sed '/^.*Out$/d' > ${IGCM_TMP}/${$}.liste_debug_files.txt
+    gawk -F/ '{dest_name=$(NF-1)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${IGCM_TMP}/${$}.liste_debug_files.txt
 
 
-ls -l ${STORE_DEBUG} > ${IGCM_TMP}/${$}.new_liste_debug_files.txt
+    ls -l ${STORE_DEBUG} > ${IGCM_TMP}/${$}.new_liste_debug_files.txt
 
 ### 2- creer les listes de fichiers par periode ####
-DEM_log -1 "Creation des 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}
+    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 )
+    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}
+    date_begin_pack=${date_begin}
+    date_end_simulation=${date_end}
 
-month_begin_pack=${month_begin}
-year_begin_pack=${year_begin}
+    month_begin_pack=${month_begin}
+    year_begin_pack=${year_begin}
 
-number_pack=1
+    number_pack=1
 
-while [ ${date_begin_pack} -le ${date_end_simulation} ]
-do 
+    while [ ${date_begin_pack} -le ${date_end_simulation} ]
+    do 
 
-DEM_log -1 "On calcule la date de fin du pack "
+	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}`
+	month_end_pack=${month_begin_pack}
+	year_end_pack=`expr ${year_begin_pack} + ${period_pack}`
 
-   date_end_pack=${year_end_pack}${month_end_pack}01   
+	date_end_pack=${year_end_pack}${month_end_pack}01   
 
-   if [ "x${ON_IDRIS}" == "xno" ]
-   then
-       for file in `awk '{print $9}' ${IGCM_TMP}/${$}.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 [ "x${ON_IDRIS}" == "xno" ]
+	then
+	    for file in `awk '{print $9}' ${IGCM_TMP}/${$}.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
-   else
-        for file in `awk '{print $8}' ${IGCM_TMP}/${$}.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
+	else
+            for file in `awk '{print $8}' ${IGCM_TMP}/${$}.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  
-   fi
+		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  
+	fi
 
 #on archive les debug - le nom de l'archive contiendra ${yearbegin}${monthbegin}_${yearend}${monthend} 
@@ -166,4 +173,5 @@
 done
 
+fi
 
 cd ${EXE_DIR}
