my ideas in action

Monthly Archives: February 2019

change the date of the JPG photos with EXIF date

Sometimes it happens that you get various photos , from a vacation, for example, that are not in the good order. The name of the file or the date of the file is wrong. This makes that, when you try to browse the pictures, some of them are not in correct chronological order.

To fix that I found really useful to use a combination of a jhead command and a self-made bash script.

Steps to do:

  1. make a backup of the photos
  2. install jheads and use it to copy the date from EXIF info to the date of the file
    1. install jhead
    2. run from terminal
    3. jhead -ft *.jpg

  3. make a script like this and run it
    1. make a script as ASCI text with nano and then chmod 755 rename_by_date.script
    2. content of the script:
      1. #!/bin/bash

        echo “rename of files based on the date:”

        ls -tr | while read i; do n=$((n+1)); mv — “$i” “$(printf ‘NewName_%04d.jpg’ “$n”)”;



That it is all.