1

I have two directories that contains the same directory structure, also directory names are same (possibly different number of files) and how can I find out the differences between all the file contents and files in Linux?

Here is an example

\dir1
  \subdir1
    \file1
  \subdir2
    \file2
    \file3


dir2
  \subdir1
    \file1
  \subdir2
    \file2
    \file3
    \file4

The content of file1 in dir1 and file1 in dir2 are different. The content of file2 in dir1 and file2 in dir2 are different. I can use

$diff dir1\subdir1\file1 dir2\subdir1\file1
$diff dir1\subdir1\file2 dir2\subdir1\file2

But I have to manually do the diff for each file. I would like to have an automatic way.

0

1 Answer 1

2

If you want to list the files being different, try:

diff -rq dir1 dir2

If you want to list the difference inside each file, remove the q:

diff -r dir1 dir2
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.