Created
June 5, 2019 23:37
-
-
Save TiiFuchs/4497c2e16ea6af63ab69446f3d08c543 to your computer and use it in GitHub Desktop.
Parses the datetime from exported Telegram photos and reinserts them as EXIF recording date.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
folder=$(realpath $1) | |
if [[ ! -d $folder ]]; then | |
echo "No valid folder." | |
exit 1 | |
fi | |
# Delete Thumbnails | |
find $folder -name "*_thumb*" -delete | |
for filepath in $folder/*.jpg; do | |
filename=$(basename $filepath) | |
time=$(echo $filename | sed -E 's/photo_[0-9]+@([0-9]+)-([0-9]+)-([0-9]+)_([0-9]+)-([0-9]+)-([0-9]+).jpg/\3:\2:\1 \4:\5:\6/') | |
echo $filename = $time | |
exiftool -overwrite_original "-DateTimeOriginal=$time" $filepath | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment