From 98509ed1b88d5aa3b131b88f23d1bbf0d4c71724 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Thu, 21 Jul 2022 10:34:36 +0200 Subject: [PATCH] rphoto: IMG -> img. --- Convention photos/Traitements/rphoto | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Convention photos/Traitements/rphoto b/Convention photos/Traitements/rphoto index b37abaa..d3fb02d 100755 --- a/Convention photos/Traitements/rphoto +++ b/Convention photos/Traitements/rphoto @@ -27,7 +27,7 @@ doRename() { local filename=$(basename $1) #echo "$filename" - jhead -nIMG%Y%m%d-%H%M%S "$filename" + jhead -nimg%Y%m%d-%H%M%S "$filename" } doRenameCarefully() @@ -35,9 +35,13 @@ doRenameCarefully() local filename=$(basename $1) #echo "$filename" if [[ $filename =~ IMG[12][90][0-9][0-9][01][0-9][0-3][0-9][012][0-9][0-5][0-9][0-5][0-9].* ]]; then - local target=${filename:0:11}-${filename:11} - echo "$filename -r> $target" - mv -f "$filename" "$target" + local target=img${filename:3:8}-${filename:11} + if [ -e "$target" ]; then + echo "$filename -r> $target ABORT because file already exists." + else + echo "$filename -r> $target" + mv "$filename" "$target" + fi elif [[ $(exiftool $filename | grep -c "Date/Time Original") > 0 ]]; then #echo "yop $filename" doRename "$filename"