Skip to content

Instantly share code, notes, and snippets.

@bjoern-r
Last active January 1, 2016 04:49
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 bjoern-r/8094560 to your computer and use it in GitHub Desktop.
Save bjoern-r/8094560 to your computer and use it in GitHub Desktop.
rename pictures and movies according the exif or file timestamp
## resulting filename 20121018-102347-IMG_4743.jpg
## rename pictures
jhead -n%Y%m%d-%H%M%S-%f *.JPG | tee rename.log
## create restore script
awk '{ print "mv " $3 " " $1 }' rename.log >rename_undo.sh
## rename movies
stat -t"%Y%m%d-%H%M%S" *.MOV | awk '{ print "echo mv " $16 " " $10"-"$16 }' | sh | tee rename-mov.log | sh -x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment