import-photos (641B)
1 #!/usr/bin/env bash 2 3 set -e 4 5 SRCDIR=$1 6 shift 7 DSTDIR=$1 8 shift 9 10 echo "Import photos from $SRCDIR to $DSTDIR" 11 echo "-------------------------------------" 12 13 TMPDIR=$HOME/tmp/google-photo-import 14 mkdir -p $TMPDIR 15 16 # 1. Copy folder to a safe place 17 rsync -av --progress --size-only "$SRCDIR" "$TMPDIR" --delete 18 # trap "rm -rf -- '$TMPDIR'" INT TERM EXIT 19 20 # 2. Run exiftool :) 21 exiftool -r -d $DSTDIR/%Y/%m/%d/%f.%%le '-filename<CreateDate' \ 22 -ext jpg -ext JPG -ext jpeg -ext JPEG -ext jpe -ext JPE \ 23 -ext 3gp -ext 3GP -ext mov -ext MOV -ext avi -ext AVI -ext mpg -ext MPG \ 24 -ext nef -ext NEF -ext mts -ext MTS \ 25 -ext HEIC -ext heic "$TMPDIR"