Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
append EXIF date taken to filename
# produce lines like
#
# mv "./IMG_8869.jpg" "2015-03-29_19-08-01_IMG_8869.jpg"
#
find \( -name 'DSC_*' -or -name 'IMG_*' -or -name 'GOPR*' \) -and -iname '*.jpg'\
| while read x; do\
echo mv \"$x\" \"$(exif --tag='Date and Time (Original)' -m "$x" | sed -e 's/:/-/g' -e 's/ /_/')_${x#./}\"; done >foo
# try one line first
awk NR==1 foo | sh -v
# maybe first 100
awk 'NR>1 && NR<=100' foo | sh -v
# whack
awk 'NR>100' foo | sh -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment