Skip to content

Instantly share code, notes, and snippets.

@kaihendry
Created June 17, 2020 06:15
Show Gist options
  • Save kaihendry/b334fdcca1a1d2eb9927d226f65e7de3 to your computer and use it in GitHub Desktop.
Save kaihendry/b334fdcca1a1d2eb9927d226f65e7de3 to your computer and use it in GitHub Desktop.
input=/mnt/sdcard/
find $input -iname "*.jpg" | while read fn
do
if test $(exiv2 -Pv -g Xmp.xmp.Rating $fn) == 3
then
dt=$(exiv2 -g Exif.Image.DateTime -Pv $fn)
read -r date time <<< "$dt"
IFS=: read -r year month day hour min secs <<< "$date"
IFS=: read -r hour min secs <<< "$time"
ymd=$(date -u -d "${year}-${month}-${day}T${hour}:${min}:${secs}" +%Y-%m-%d)
ssh [email protected] "test -d /mnt/red/redsamba/$ymd || mkdir /mnt/red/redsamba/$ymd"
echo rsync $fn [email protected]:/mnt/red/redsamba/$ymd/$(basename $fn)
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment