Skip to content
Advertisement

Finding difference between 2 directories in linux

Hi guys,

      I was trying to find the difference between two directories, dir structure as follows.
  1. dir1/subdir/file.txt
  2. dir2/subdir/nffile.txt

when i tried with “diff -r dir1 dir2” it shows only the content difference in files but i want interns of new file addition.

Any possibility that we can find the difference between these dir using the “diff” command.

Advertisement

Answer

Try out using --brief option something like:

$ diff --recursive --brief dir1 dir2
Only in dir1/dir1: file1
Only in dir2/dir1: file2
Only in dir1: dir2
$
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement