From: bouilhol Date: Tue, 9 Nov 2010 13:52:35 +0000 (+0000) Subject: don't crash if ther is a "/" in the dicom field X-Git-Tag: v1.2.0~299 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=98d7fe76840e2f961eb575e5904f2c5028de8754;p=clitk.git don't crash if ther is a "/" in the dicom field --- diff --git a/vv/scripts/dcm_sort_by_field.sh b/vv/scripts/dcm_sort_by_field.sh index 3ce4ec9..06ffd05 100755 --- a/vv/scripts/dcm_sort_by_field.sh +++ b/vv/scripts/dcm_sort_by_field.sh @@ -19,7 +19,8 @@ do { name="$(clitkDicomInfo "$i" | grep "$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 - [ -d "sorted/$name" ] || mkdir "sorted/$name" 2>>/dev/null + [ -z `echo $name | grep "/"` ] || name=`echo $name | sed 's/\//\_/'` + [ -d "sorted/$name" ] || mkdir "sorted/$name" 2>>/dev/null basename=$(basename "$i") cp -l "$i" "sorted/$name/$basename" }&