Compare two folders(recursively) for file names and file contents
Dear all,
I have received a hard disk from our technical department that has my data copied to a larger hard disk. I still also have the original disk with me and I was thinking if thereŽis any way to compare files and folders differences (not only file names as diff returns but also in their contents, so to make sure that the copy worked ok). I What do you suggest? A |
generate a list on the two drives, like ls -lR and compare the two results.
|
Maybe use rsync -n (dry run) to generate a list of different files, then feed the pairs to diff to compare contents.
Maybe diff has an option for this type of compare but I'm no guru with it. |
Actually I have tried this one...
rsync -rvnc website/ laptop:projects/website/ |
Dry run with the update switch (-u) meaning it will only overwrite changed files.
Code:
rsync -ruptvn src/ dst/ > /tmp/output Assuming you're using bash with the following, Code:
sourcedir=src;destdir=dst;cat /tmp/output | while read file;do diff -rupN $sourcedir/$file $destdir/$file;done >> /tmp/differences;unset sourcedir destdir SAM |
I was looking for...
A similar answer. I found this:
http://superuser.com/questions/16631...omparing-files Basicaly, you run diff with two flags "qr" as follows: diff -qr dir1 dir2 Make shure you substitute dir1 and dir2 with the directory paths that you want to compare. It will let you know if there are any diferences in directory structure and file contents. Regards. |
Quote:
|
Quote:
Code:
user$ mkdir foo bar |
another approach can be to use dupfinder....
|
You might also like to take a look at 'man cmp'.
|
All times are GMT -5. The time now is 08:15 PM. |