]> Creatis software - clitk.git/commitdiff
Copy to "unsorted" directory if dicom key not found
authorbouilhol <bouilhol>
Wed, 24 Nov 2010 13:49:01 +0000 (13:49 +0000)
committerbouilhol <bouilhol>
Wed, 24 Nov 2010 13:49:01 +0000 (13:49 +0000)
vv/scripts/dcm_sort_by_field.sh

index f758ee3345200342a963b79c0a5ee00783bc2686..44dba5980643a1f06818dc5be68f7ad175c88fda 100755 (executable)
@@ -18,7 +18,8 @@ do
         read i || { wait; break 2; }
         {
             name="$(clitkDicomInfo "$i" | grep "$1" | head -n 1 | sed "s/.*\[//;s/.$//;s/ /_/g")"
-            [ -z "$name" ] && echo "Warning: key not found in file $i" 1>&2 && exit 1 #don't do anything if dicom key not found
+           [ -z "$name" ] && echo "Warning: key not found in file $i" 1>&2 && mkdir -p unsorted && basename=$(basename "$i") && cp -l "$i" "unsorted/$basename" && exit 1 #copy to unsorted directory if dicom key not found
+            #[ -z "$name" ] && echo "Warning: key not found in file $i" 1>&2 && exit 1 #don't do anything if dicom key not found
             name=`echo "$name" | sed 's/\//_/g'`
            name=`echo "$name" | sed 's/\\\/_/g'`
            name=`echo "$name" | sed 's/\*/_/g'`