# For files in current folder for f in * ; do # $folder = path to my images missing metadata folder=/usr/src/app/upload/library/admin/2023/2023-05-31 # Move the file to /tmp mv "$f" /tmp # Run ffmpeg over the file to hopefully fix it ffmpeg -i /tmp/"$f" $folder/"$f" # Run exiftool over the new file to wipe the metadata /usr/src/app/node_modules/exiftool-vendored.pl/bin/exiftool -overwrite_original -progress -all= "$f" # Set $name to the file name minus 6 characters from the end name=${f:0:-6} # Set $json to the matching json file (if it can find one) json=$(find /exifprocess/ -name "$name*json") # Run exiftool over the new file, importing metadata from the json file /usr/src/app/node_modules/exiftool-vendored.pl/bin/exiftool -tagsfromfile "$json" "-DateTimeOriginal