Created
November 17, 2016 10:45
-
-
Save julesjans/9f3a7174955cbac51c45dedb1a5de1e2 to your computer and use it in GitHub Desktop.
Renames images according to their date
This file contains hidden or 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 | |
# | |
# Image renaming script, requires exiftool | |
for f in "${1%/}"/*.{jpg,jpeg} | |
do | |
if [ -f "$f" ] | |
then | |
echo "Preparing $f" | |
filename=$(basename "$f") | |
dirname=$(dirname "$f") | |
newname=$(exiftool -createdate "$f" | grep -o '[0-9:]*\s[0-9:]*$' | sed 's/[^0-9]/-/g') | |
echo "Completed $dirname/$newname.jpg" | |
mv "$f" "$dirname/$newname.jpg" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment