I recently posted a question about how to rename image filenames in a stable way to the exif date:

Exiv2 rename: Make unique filenames

This is a follow up question to it:

How can I additionally to the requirements in my first post make sure that no duplicate files are created. Consider for example three files fileA.jpg, fileB.jpg, fileC.jpg.

Suppose that fileA.jpg and fileB.jpg have the same exif time, say 2017:09:30 20:12:31 but are different images, i.e. not bitwise identical files. fileC.jpg however is the same as fileA.jpg.

Now if I apply the renaming command to the directory containing those files, I want to get:

  • 2017_09_30__20_12_31.jpg (from fileA.jpg)
  • 2017_09_30__20_12_31-1.jpg (from fileB.jpg)

And fileC.jpg should be deleted, since it is bitwise the same as fileA.jpg.


Do it in two jobs:

  • Delete duplicates
  • Rename files

An easy way to remove duplicates is by installing fdupes first and run it in current directory:

fdupes ./ --delete --noprompt

The first time you might want to run it without --noprompt.

(In the link to Exiv2 rename: Make unique filenames you did not flagged the answer which solved your problem. Pls do.)

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.