#!/bin/bash function set_file_desc { image="$*" echo "${image}" xid=$(exiftool -s -EXIF:ImageDescription "${image}") if [ ${#xid} -lt 3 ]; then xdd=$(exiftool -s3 -Description "${image}") if [ ${#xdd} -gt 2 ]; then echo " Description -> ${xdd}" exiftool -P -overwrite_original -EXIF:ImageDescription="${xdd}" "${image}" else xti=$(exiftool -s3 -Title "${image}") if [ ${#xti} -gt 2 ]; then echo " Title -> ${xti}" exiftool -P -overwrite_original -EXIF:ImageDescription="${xti}" "${image}" else xon=$(exiftool -s3 -IPTC:ObjectName "${image}") if [ ${#xon} -gt 2 ]; then echo " ObjectName -> ${xon}" exiftool -P -overwrite_original -EXIF:ImageDescription="${xon}" "${image}" fi fi fi fi echo " Removing ObjectName" exiftool -P -overwrite_original -IPTC:ObjectName= "${image}" } function show_file { ls -l "$*" } find . -name "*.jpg" -type f -print0 | while IFS= read -r -d '' file; do set_file_desc "${file}" done