cmp or diff? which is more accurate? work for any file?
When I read the man pages for "diff", it says compare files line by line. Then when I read man pages for "cmp" it says compare two files byte by byte.
Someone said to me cmp is more accurate for data verification since it does comparison byte by byte. The way I see it though, is that even diff does a byte by byte comparison, I mean if two lines are identical, then that implies that each character is identical, which means each byte is indeitical. Am i correct here?
Also, this means it is doin a comparison at the binary level yes?
You see, I have drives which contain back ups (like 100GB+) of data. This data is in form of files with several subdirectories etc. So I want to do a file verification to ensure that the back up hard disk and original hard disk are identical (so binary comparison, for best accuracy). The files are all sorts of datatype, so not just text. Even AVI files.
diff seems to be best for my needs as I just give it a directory and it goes through all sub directories too if i specify to do so. cmp requires me to write a shell file. Also for one file comarisons, i noticed cmp is slower, does that mean it is indeed more accurate?
Is there an alternative method for comparing files/folders?
|