Andrew McGill on Mon, 3 Apr 2000 14:22:53 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: GLUG: Comparing files


<?> It sounds like you are trying to do differential backups ... surely
there is a better way .. tar --append / tar --update?  Or synchronisation?
rsync ... </?> Anyway, in reply:

>1) How do I compare the contents of files (binary), i.e. determine the
>differences (if any)?

diff -q file1 file2

If you were planning to do something intelligent with the differences, you
won't want to use -q ...


>2) How do I compare the contents of a partition and an image file created
>with the dd command (binary)?

diff -q /dev/part1 file2img (I think) (generally this will be totally
pointless, since the access times will have changed ...), or mount the file
using the loopback device, and do (3) ...


>3) Is it possible to apply 1) and 2) recursively over a complete
>subdirectory?

Without pointing out that the question is meaningless (a partition is not a
subdirectory), here's an answer:

cd /dir1; find . -exec diff -q {} /dir2/{} \;       (I think, again)


&:-)