Confirm that two filesystems are identical, ignoring special files

Posted by endolith on Super User See other posts from Super User or by endolith
Published on 2011-06-15T14:41:09Z Indexed on 2012/09/06 15:41 UTC
Read the original article Hit count: 234

Filed under:
|
|
|
|

/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

and

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?

© Super User or respective owner

Related posts about linux

Related posts about diff