#! /bin/bash -x

storage=/opt/data/family
 
move() {
  exiftool -r -v -ext $2 '-directory<DateTimeOriginal' \
           -d "${storage}/$3/%Y/%m" "$1"
}
 
# directory where to read media files from is $1
# if unspecified use current directory
dir=${1:-.}
 
move $dir AVI videos
move $dir JPG photos

#! /bin/bash -x

storage=/opt/data/family
 
move() {
  exiftool -r -v -ext $2 '-directory<AllDates' \
           -d "${storage}/$3/%Y/%m" "$1"
}
 
# directory where to read media files from is $1
# if unspecified use current directory
dir=${1:-.}
 
move $dir jpg photos
move $dir avi videos
move $dir mp4 videos

Use exiftool 'AllDates' shortcut tag for more reliable date extraction (to also support mp4 videos)
Use exiftool 'AllDates' shortcut tag for more reliable date extraction (to also support mp4 videos)
