Following is the directory structure
Folder1 subFolder1 File1.txt File2.txt subFolder2 File3.txt subFolder3 Folder2 subFolder1 File1.txt File2.txt subFolder2 File3.txt File4.txt subFolder3 File5.txtI want to compare the contents of each file in Folder1 with the corresponding file in the Folder2.
i.e I want to check the contents of Folder1/subFolder1/File1.txt with the contents of Folder2/subFolder1/File1.txt
I used the unix command
diff -b Folder1/subFolder1/File1.txt Folder2/subFolder1/File1.txtThis works! But I would like to do this recursively for each file within the subFolders.
Kindly provide some pointers to this...
11 Answer
Without any option, running the diff command on two directories will tell you which files only exist in one and not the other, and which are common files. Files that are common in both directories are diffed to see if and how the file contents differ.
To do sub-dirs you need to pass -r option to do recursive search.
So just run the following command and you should get desired results:
diff -br /path/to/Folder1 /path/to/Folder2 2