I have two directories that contain directories and source files. One directory contains the modified source code and the other one is unmodified source code. And I want to see what source code was modified and see the modified part of the code. And I also want to output the result to a single text file.
I know I have to use the diff tool but I'm not sure what options should I use. Do I need to create a script for this, or is there a one line command to do the task?
To do so, click “View” in the top bar, and then untick “Show identical items” by clicking on it. Click on the “Select Files or Folders” tab in the far left, to start a new comparison. Each comparison you run opens in a new tab.
Use the dircmp command to compare two directories specified by the Directory1 and Directory2 parameters and write information about their contents to standard output. First, the dircmp command compares the file names in each directory.
Using Meld Visual Diff and Merge Tool Click on directory comparison and move to the next interface. Select the directories you want to compare, note that you can add a third directory by checking the option “3-way Comparison”. Once you selected the directories, click on “Compare”.
You might want to do something like
diff -rw directory1 directory2 > diff.txt
where -r makes it recursive (so all sub-directories are scanned, too), -w is for ignoring all white-space (e.g., stray spaces or tabs somebody inserted), and > diff.txt redirects your output to the file diff.txt. More options can be found in the man page:
man diff
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With