Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

/media/A and /media/B should be identical, but I want to confirm before deleting one.

Duplicate file finders don't work, because they'll find two copies of the same file within B, for instance. I only want to confirm that every file in one is identical to the other.

diff -qr /media/A/ /media/B/ seems to work, but the output is cluttered with garbage like

diff: /media/A//etc/alternatives/ControlPanel: No such file or directory


File /media/A//dev/tty8 is a character special file while file /media/B//dev/tty8 is a character special file

I can suppress the former with 2> /dev/null, but I don't know about the latter.

rsync -avn /media/A/ /media/B/ also produces a bunch of clutter, like "skipping non-regular file".

How can I compare the two trees and just make sure that all the real files exist in both and are identical?

share|improve this question
You don't mention the operating system. I'm guessing that it is some linux/unix variant, so your message might get more responses if it was tagged as such. However, if I was doing this in Windows, I would use one of my favourite tools Beyond Compare (from which also has a linux version. This isn't free, but there is 30 day trial. The only other way that I know would be to pipe the diff output to a file and then try to strip out the irrelevant lines until it gets to a manageable size. You can use sed to do this or is it awk? (It's been years since I use either) – sgmoore Jun 15 '11 at 19:09

Using this following command should check to see if they are identical.

diff imageA imageB -r 2> /dev/null | grep -v "is a character special file" | grep -v "is a block special file" && echo "viola"
share|improve this answer

Take a look at Guiffy. It's not free, but has a 21 day free trial, which doesn't limit functionality :

Guiffy home page

Full (massive) list of features

It claims to do the following, and seems to be very close to what you are looking for, or may get close enough that you can take it from there:

  • Folder Compare works with Unicode file/folder names
  • Folder Compare works with archive files (.zip, .tar, .jar, and others).
  • Save compare reports - the Guiffy folder compare tool generates reports as HTML
  • Quickly launches a file compare from the folder compare.
  • User friendly folder compare view with Explorer-like interface and expandable sub-folders.
  • Folder Compare interface includes popup menus for file synchronization operations.
  • Recursive compare option - folder compare can do a file tree compare.

enter image description here

share|improve this answer

Use rsync in write mode (with -v/--verbose and without -n/--dry-run), and run it a few times until the output stabilises. Run it as root so that recreating non-regular files (implied by -D and -a) works, which should get rid of the clutter.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .