- Timestamp:
- 08/26/13 12:26:57 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
r936 r941 106 106 107 107 eval set +A entityListe \${${1}} 108 destination=${2} 108 destination=${2} 109 109 sumSizeKo=0 110 110 111 111 # Here we will try to compute size (file or directory size) from local path and not from archive. 112 for ((i = 0; i < ${#entityListe[*]}; i += 1)) ; do 113 if [ -f ${entityListe[$i]##/*/} ] ; then 114 # One file or a bunch of files has been copied without renaming 112 for ((i = 0; i < ${#entityListe[*]}; i += 1)) ; do 113 if [ -f ${entityListe[$i]} ] ; then 114 # One file or a bunch of files has been copied without renaming from a visible filesystem 115 iEntity=${entityListe[$i]} 116 elif [ -f ${entityListe[$i]##/*/} ] ; then 117 # One file or a bunch of files has been copied without renaming from an non visible filesystem 115 118 # remove path /home/login/../ from entityListe elements 116 119 iEntity=${entityListe[$i]##/*/} 117 120 elif [ -f ${destination} ] ; then 118 # a file has been copied and rename 121 # a file has been copied and renamed 119 122 iEntity=${destination} 120 123 elif [ -f ${destination}/${entityListe[$i]##/*/} ] ; then … … 122 125 iEntity=${destination}/${entityListe[$i]##/*/} 123 126 elif [ -d ${entityListe[$i]} ] ; then 124 # directory has been copied fromnon remote place127 # a directory has been copied from a non remote place 125 128 iEntity=${entityListe[$i]} 126 129 elif [ -d ${destination}/${entityListe[$i]##/*/} ] ; then 127 # directory has been copied from remote archive and not rename130 # a directory has been copied from a remote archive and not renamed 128 131 iEntity=${destination}/${entityListe[$i]##/*/} 129 132 elif [ -d ${destination} ] ; then 130 # directory has been copied from remote archive and rename133 # a directory has been copied from a remote archive and renamed 131 134 iEntity=${destination} 132 135 fi 133 sizeKo=$( du --apparent-size -sk ${iEntity} | awk {'print $1'})136 sizeKo=$( du --apparent-size -sk ${iEntity} | gawk '{print $1}' ) 134 137 sumSizeKo=$(( $sumSizeKo + $sizeKo )) 135 138 done 136 139 sumSizeMo=$( echo "scale=6;${sumSizeKo}/1024" | bc ) 137 140 echo "${sumSizeKo}|${sumSizeMo}" 138 139 141 } 140 142 … … 264 266 if ( $DEBUG_debug ) ; then 265 267 typeset i decal command arguments startTime_ms endTime_ms 266 typeset instrumentation dest 268 typeset instrumentation dest prefix 267 269 # they are not typeset because they are send "by adress" to son functions 268 270 # we unset them to avoid "memory effect" … … 379 381 entitySize=$( IGCM_debug_sizeOfTabContent fileList ${dest} ) 380 382 ;; 381 383 382 384 # NCO commands 383 385 IGCM_sys_ncrcat|IGCM_sys_ncecat|IGCM_sys_ncra|IGCM_sys_ncks|IGCM_sys_cdo) … … 388 390 # IGCM_sys_ncrcat -x -v ${list_var} -p ${dir} ${liste_file_tmp} --output ${output} 389 391 instrumentation=true 390 # All files that are not the latest argument (only input files) 392 keepGoing=true 393 prefix=. 391 394 i=0 392 keepGoing=true393 395 while ( ${keepGoing} ) ; do 394 if [ -f ${arguments[${#arguments[*]}-2-${i}]} ] ; then 395 fileList="${fileList} ${arguments[${#arguments[*]}-2-${i}]}" 396 # the last one is not interesting 397 if [ ${i} -eq ${#arguments[*]}-1 ] ; then 398 keepGoing=false 399 # look after "-p" option. Path prefix is the following arguments 400 elif [ ${arguments[${i}]} = "-p" ] ; then 396 401 ((i = i + 1)) 397 elif [ ${i} -ge 1 ] ; then 402 prefix=${arguments[${i}]} 403 ((i = i + 1)) 404 elif [ ${i} -eq ${#arguments[*]}-1 ] ; then 398 405 keepGoing=false 406 # looking for files 407 elif [ -f ${prefix}/${arguments[${i}]} ] ; then 408 fileList="${fileList} ${prefix}/${arguments[${i}]}" 409 ((i = i + 1)) 410 # other options are not interesting 399 411 else 400 412 ((i = i + 1)) 401 413 fi 402 414 done 415 403 416 # i value is at least 1 404 417 # just need one file to get the directory 405 source=$ {arguments[${#arguments[*]}-1-${i}]}418 source=$( echo ${fileList} | gawk '{print $1}' ) 406 419 # Nothing but the latest 407 420 dest=${arguments[${#arguments[*]}-1]}
Note: See TracChangeset
for help on using the changeset viewer.