From 3e81c1a5f4840f6d1bb0407d3c8a363b7d5d5b2f Mon Sep 17 00:00:00 2001 From: bouilhol Date: Wed, 24 Nov 2010 13:49:01 +0000 Subject: [PATCH] Copy to "unsorted" directory if dicom key not found --- vv/scripts/dcm_sort_by_field.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vv/scripts/dcm_sort_by_field.sh b/vv/scripts/dcm_sort_by_field.sh index f758ee3..44dba59 100755 --- a/vv/scripts/dcm_sort_by_field.sh +++ b/vv/scripts/dcm_sort_by_field.sh @@ -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'` -- 2.47.1