Skip to content

Instantly share code, notes, and snippets.

@dbcesar
Last active May 22, 2018 09:15
Show Gist options
  • Save dbcesar/aa265334e32d6f7b1a08c4fb62fce385 to your computer and use it in GitHub Desktop.
Save dbcesar/aa265334e32d6f7b1a08c4fb62fce385 to your computer and use it in GitHub Desktop.
Script for register the date taken in the Exif information for pictures taken by Eken H6s cameras. From the PHOTO folder, set the date taken information on the camera exif. This is required for sort images by date. The script will rename files to match the exiftool requirements and later will set the date.
##!/bin/bash
set -e
for D in *
do
if [ -d "$D" ]
then
cd $D
for f in *.JPG
do
#rename files in order to match the pattern YYYYMMDDHHMMSS
mv "$f" "20${D::-3}$f"
echo "File $f was renamed to 20${D::-3}$f"
done
exiftool -overwrite_original "-datetimeoriginal<filename" *.JPG
cd ..
fi
done
echo "Files were changed sucessfully"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment