February 13, 2019
Posted by on
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:
- make a backup of the photos
- install jheads and use it to copy the date from EXIF info to the date of the file
- install jhead
- run from terminal
jhead -ft *.jpg
- make a script like this and run it
- make a script as ASCI text with nano and then chmod 755 rename_by_date.script
- content of the script:
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.