X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=scripts.git;a=blobdiff_plain;f=archivepics.sh;h=783effd6201a4c2336ed6a6a76d137a43b1ea942;hp=40ad62d2e0e08225d1285f60182fb0bdf36c0869;hb=0b5965cd1e6ed1758170691ac858b74be6e1ea0b;hpb=6a45dbe664eebcb3050d0c3dfe9856f7c5815aca diff --git a/archivepics.sh b/archivepics.sh index 40ad62d..783effd 100755 --- a/archivepics.sh +++ b/archivepics.sh @@ -49,7 +49,7 @@ for i in "$@"; do if [[ ! -f ${i/JPG/MOV} ]] && [[ ! -f ${i/JPG/3gp} ]]; then - if [[ $(stat --printf=%s $i) -lt ${archive_size_min} ]]; then + if [[ $(stat --printf=%s "$i") -lt ${archive_size_min} ]]; then echo "Image $i is too small." exit 1 fi @@ -72,12 +72,14 @@ for i in "$@"; do if [[ -f ${ref} ]]; then - TAG=$(exif --ifd=EXIF -t "Date and Time (original)" ${ref} | grep Value) + echo "Checking ${ref} date" + + TAG=$(exif --ifd=EXIF -t "Date and Time (original)" "${ref}" | grep Value) if [[ ${TAG} ]]; then TIMESTAMP=$(echo ${TAG} | sed -e \ "s/^ *Value: *\([0-9]*\):\([0-9]*\):\([0-9]*\) *\([0-9]*\):\([0-9]*\):\([0-9]*\).*$/\1\2\3\4\5.\6/") - touch -t $TIMESTAMP $i + touch -t $TIMESTAMP "$i" else echo "No exif tag in $i, can not set the date properly." fi @@ -95,12 +97,12 @@ done for i in "$@"; do - ARCHIVING_PATH=$(ls -l --time-style=+%Y/%b --format=verbose $i | awk '{ print $6 }') + ARCHIVING_PATH=$(ls -l --time-style=+%Y/%b --format=verbose "$i" | awk '{ print $6 }') mkdir -p ${IMAGE_ARCHIVE_DIR}/${ARCHIVING_PATH} - echo "Archiving ${IMAGE_ARCHIVE_DIR}/${ARCHIVING_PATH}/$(basename $i)" + echo "Archiving ${IMAGE_ARCHIVE_DIR}/${ARCHIVING_PATH}/"$(basename "$i") - cp -p -i $i ${IMAGE_ARCHIVE_DIR}/${ARCHIVING_PATH} + cp -p -i "$i" ${IMAGE_ARCHIVE_DIR}/${ARCHIVING_PATH} done