Okay I have been struggling with diff for the last day or so. I want to use it in a script which will verify that two directories have the same files and the files themselves are identical.
Basically I have been trying to use diff to output the differences between two directories in a readable format.
The above command prints out whether any files found in each directory differ, i.e. if one file is in one directory and not in the other.
However, I want to delve deeper into the directories, and check each file within them recursively, printing out which files differ from oneanother, and, if they are different, how (i.e. print out the differing files next to one another for inspection). Reading the man page for diff lead me to believe the following would work:
The "r" switch is to diff the directories recursively, and the "y" switch is to print out the results next to oneanother in 2 columns. One would think this would work exactly as I need, but alas it appears to print out the content of every single file within the 2 directories, regardless of whether they differ from oneanother or not.
Sorry for the essay-length post, but I really need assistance on this. And yes, I have asked Google - he wasn't too sure...
tl;dr version:
Need to use diff to print out which files in two seemingly-identical directories differ. And print out the contents of each differing file next to oneanother for inspection.
Help!
Basically I have been trying to use diff to output the differences between two directories in a readable format.
Code:
diff /home/directory/test/ /backup/directory/test/
The above command prints out whether any files found in each directory differ, i.e. if one file is in one directory and not in the other.
However, I want to delve deeper into the directories, and check each file within them recursively, printing out which files differ from oneanother, and, if they are different, how (i.e. print out the differing files next to one another for inspection). Reading the man page for diff lead me to believe the following would work:
Code:
diff -yr /homed/directory/test/ /backup/directory/test/
The "r" switch is to diff the directories recursively, and the "y" switch is to print out the results next to oneanother in 2 columns. One would think this would work exactly as I need, but alas it appears to print out the content of every single file within the 2 directories, regardless of whether they differ from oneanother or not.
Sorry for the essay-length post, but I really need assistance on this. And yes, I have asked Google - he wasn't too sure...
tl;dr version:
Need to use diff to print out which files in two seemingly-identical directories differ. And print out the contents of each differing file next to oneanother for inspection.
Help!