# exifinfo - extract EXIF info for all photos in a directory # - using exiftool, free download from exiftool.org # - script by Owen Townsend, Feb/2022 # # This script $UV/sf/util/exifinfo called by $UV/sf/util/renameJPG1 # renameJPG1 - copies jpg files from 1 dir to 2nd dir, prefixing names with date_time # - calls exifinfo to extract date/Time info for all photos in a directory (yyyymmdd) # - then calls makeJPGrenames to create scripts to rename the photos with date/time prefixes # yyyymmdd_hhmmss_OriginalCameraFilename (dscf0001.jpg, dscf0002.jpg, etc) # - sample command & output for 3 photos in directory 'photodir' # # exifinfo photodir # ================= # DSCF0016.jpg DT=2003:09:07 20:01:03 ISIZE=1600x1200 FSIZE=161 kB MODEL=FinePix4800 ZOOM # BMO.jpg DT=2018:05:06 08:49:04 ISIZE=5184x3888 FSIZE=6.4 MB MODEL=Canon PowerShot ELPH 360 HS # Oliver.jpg DT=2019:08:30 16:25:27 ISIZE=2253x3006 FSIZE=1413 kB MODEL=iPhone 7 # test -d exifinfo || mkdir exifinfo # mkdir ./exifinfo if not present (to store exifinfo/reports) dir="$1"; if [[ ! -d "$dir" ]]; then echo "usage: exifinfo directory" echo " ==================" echo " - arg1 must be a directory of images jpg,mov,mp4,etc" exit 99; fi # # translate any '/' slashes in $dir to '_' underscores dirt=$(echo $dir | tr '/' '_') # echo "exifinfo - extract JPG info for makeJPGrenames " exiftool -q -f -p '$filename DT=$CreateDate ISIZE=$imagesize FSIZE=$filesize MODEL=$model' \ -d %Y%m%d_%H%M%S $dir >exifinfo/$dirt.exif 2>exifinfo/$dirt.exif_ERRS #============================================================================================ # echo "exifinfo written to exifinfo/$dirt.exif & any ERRORs to exifinfo/$dirt.exif_ERRS" # show only the ERROR file here to alert user (can later investigate both files) if [[ -s exinfo/$dirt.exif_ERRS ]]; then echo "---------------------- exifinfo/$dirt.exif_ERRS -----------------------------" more exifinfo/$dirt.exif_ERRS else rm -f exifinfo/$dirt.exif_ERRS fi exit 0