Finding difference between 2 directories in linux
Hi guys,
      I was trying to find the difference between two directories, dir structure as follows.
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.
尝试使用--brief选项,如: 
$ diff --recursive --brief dir1 dir2
Only in dir1/dir1: file1
Only in dir2/dir1: file2
Only in dir1: dir2
$
Alt.1 - use of diff
diff <(ls dir1) <(ls dir2)
Alt.2 - script without use of diff
 for i in /my/directory/*; do
    name=$(basename "$i")
    if [[ ! -e "/my/other/directory/$name" ]]; then
       echo $name not found in other directory
    fi
 done
diff -qrN dir1 dir2
if one of the directories has a name that can be confused with a paramenter
diff -qrN -- -f -z
where -f and -z are actually directory names
 remove the q parameter to have more detail about what changed.  If you want even more detail use the following  
diff -rupN -- dir1 dir2
下一篇: 在linux中查找2个目录之间的差异
