5

I've got some photos with quite random names, but the dates (not exif, but when they were last edited) are correct. I'd like to rename them in that order, preferably so that the first photo is named "1.jpg" and so on, but anything goes. Anyone knows how that is done?

  • If you search for "rename" in the Ubuntu Software Center, you'll find several utilities that make it easy to bulk rename files. pyRenamer, Purrr, and GPRename are all great options. – ændrük May 23 '11 at 16:12
  • Also KRename & GwenRename, if your desktop is KDE – Syborgia Alphas Jul 13 '11 at 8:49
7

In the directory containing the pictures, run:

mkdir renamed; num=0; for f in $(ls -t); do cp -p "$f" renamed/IMG_$(printf "%03d" $num).jpg; num=$((num+1)); done

This will copy the files to a new directory renamed, keeping timestamps untouched. The format will be IMG_###.jpg with three-digit numbers, using leading zeros. You can change the number of digits by changing the %03d part.

  • 1
    Thanks! PS: If you want the oldest photo to have the lowest number and newest to have the last, then change ls -t to ls -tr – Umang Oct 25 '12 at 14:04
2

Try PyRenamer. I have just installed it and it seems very powerful. It allows you to rename your images based on their metadata.

  • You can use imagedate, but how do you use file metadata? – Redsandro Jun 3 '15 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.