9

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/

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
Elysium
  • 11,012
  • I initially voted to close it as a duplicate but now I don't think it's a duplicate because it's about finding images. – Sergey Nov 07 '12 at 23:43
  • This question appears to be relevant: http://askubuntu.com/questions/59107/find-duplicate-files-and-folders-and-move-these-to-a-different-folder – Anderson Green Dec 14 '12 at 04:57

4 Answers4

8

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.

Robert Vila
  • 406
  • 2
  • 10
  • Thanks for the answer. Can gthumb also compare 2 folders and tell me which files are the same or different in them? – Elysium Nov 09 '12 at 01: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 09 '12 at 02:14
  • What do you think about filezilla, xxdiff and kdiff3 http://filezilla-project.org http://kdiff3.sourceforge.net/ http://furius.ca/xxdiff/ – Robert Vila Nov 09 '12 at 02: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 09 '12 at 03: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 09 '12 at 13:33
  • 10000!! OF course you can't do that manually!. But you haven't described more details of your problem. You want to eliminate duplicates, but want to have everything in one dir? or you want to have some files in one directory and some in another? what is the criteria to leave them in one place or another? – Robert Vila Nov 10 '12 at 02:28
  • ... If you want to automate the task you have to specify exactly what you want. Diff will give you a list. You can process the list and then use it to delete. You could merge the directories, if the copies have the same name (do they??) and you will end up with one directory containing everything (one copy of each file).... what is the situation?: the files have one single copy or more than one? same name or not?, and what do you want to have in the end, exactly? – Robert Vila Nov 10 '12 at 02:28
2

just use diff directory1 directory2

pbfy0
  • 305
2

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

Sergey
  • 43,665
  • I'll have a look and let you know how they work. Thanks. – Elysium Nov 07 '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 08: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
2

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.

tricasse
  • 121
  • I can vouch for these tools as well. – belacqua Oct 04 '15 at 02:12
  • gThumb provides thumbnail images when comparing duplicates, but it kept causing a kernel panic and crashing my machine when I'd try to find duplicates across 60k files.

    dupeGuru doesn't have thumbnail previews, but it handled the massive number of files I had with ease. Thanks for the suggestion!

    – OozeMeister Nov 27 '21 at 18:42