I am wondering if there is a way to compare folders in Ubuntu? I have tried to organize my photo folders many times...and for this reason I have several folders that contain the same files (maybe a couple of extra ones) and it would be great to have a tool to figure out which files are extra and which files are identical.

P.S. I have just found an application that works well. It's called FSlint. Here is a link to it with a detailed description: http://www.addictivetips.com/ubuntu-linux-tips/clean-up-ubuntu-remove-duplicates-with-fslint-filesystem-lint/


diff will help you find duplicate files in two different directories, but if your mess is greater or if, for any other reason, you want to find duplicate (exact) image files in a whole directory, including subdirectories, you can use the gthumb image browser viewer, which is probably already installed in your system.

Gthumb provides a tool to search for duplicate media/audio/video/images/text/all files in a directory. To do this, just select your directory in the view mode that displays a left pane with your directory tree, and then, from the menu select Edit>Find duplicates... a dialogue window shows the duplicates and lets you choose which file(s) to delete. This procedure is visual and helpful in many cases; but it is slow, if you have too many duplicate files to delete.

  • Thanks for the answer. Can gthumb also compare 2 folders and tell me which files are the same or different in them? – Elysium Nov 9 '12 at 1:09
  • I don't think so. Use diff for that or ... there are other tools, I can't recall their names, for that purpose. – Robert Vila Nov 9 '12 at 2:14
  • What do you think about filezilla, xxdiff and kdiff3 filezilla-project.org kdiff3.sourceforge.net furius.ca/xxdiff – Robert Vila Nov 9 '12 at 2:33
  • If you want to use gThumb, the following may be practical or not depending on the amount of files you have: You can put both directories inside a new directory; then use gThumb to find duplicates in that new dir; then you proceed to browse the results and/or delete the copies you want according to which directory they belong to. – Robert Vila Nov 9 '12 at 3:29
  • Hey Robert. I must say that Gthumb is a great application, but I have just found 10.000 duplicates and deleting them one by one seems to be a tedious task to do. :) I need to find another way. – Elysium Nov 9 '12 at 13:33

just use diff directory1 directory2

  • That wouldn't work well for directories full of binary files – Sergey Nov 7 '12 at 23:31
  • 1
    It would. All it says is only in directory1: someFile – pbfy0 Nov 8 '12 at 0:00
  • Ok, you're right, diff is smart enough to not try to compare binary files line by line. And -r option even allows to compare directories recursively. Nice. – Sergey Nov 8 '12 at 0:12

If you want to find duplicate files, you can use fdupes program as explained in this question: How to find (and delete) duplicate files

However, with a photo collection this won't find different versions of an image (you can have multiple copies of an image with different metadata, different resolution etc.)

To find dupolicated images you can use DigiKam, which is in general an awesome tool for managing a photo collection. It has Find Duplicate Images Tool:

find duplicate images tool

  • I'll have a look and let you know how they work. Thanks. – Elysium Nov 7 '12 at 23:49
  • Sorry to say, but this application has many issues. You cant select several images. I have 10.000 photos...so this is an application that would not replace the tedious manual work at all. Thanks anyway. – Elysium Nov 10 '12 at 8:04
  • @Elysium: what do you mean by "You cant select several images"? I ran "Find duplicates" on my collection of photos, ~60.000 of them, and it appears to do what it says on the box. Unlike diff or any other file-based method, it also finds duplicates even if file format is different (JPEG/RAW etc.) – Sergey Nov 10 '12 at 15:32

You may want to have a look at dupeGuru Picture Edition. Seems like one of the best options to me, if not the best, handling also similar (non-identical) images.

For exact duplicates and scripting you might use duff.

  • I can vouch for these tools as well. – belacqua Oct 4 '15 at 2:12

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