Confirm that two filesystems are identical, ignoring special files
- by endolith
/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?