From 98d7fe76840e2f961eb575e5904f2c5028de8754 Mon Sep 17 00:00:00 2001 From: bouilhol Date: Tue, 9 Nov 2010 13:52:35 +0000 Subject: [PATCH] don't crash if ther is a "/" in the dicom field --- 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 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" }& -- 2.47.1