Skip to content

Instantly share code, notes, and snippets.

@rctay
Created April 11, 2015 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rctay/6e583e956c37a310c2f7 to your computer and use it in GitHub Desktop.
Save rctay/6e583e956c37a310c2f7 to your computer and use it in GitHub Desktop.
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