Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I think I have two directories with the same content, but I want to check it.

Also, I want to exclude a folder that is inside both directories.

How can I do it?

share|improve this question

1 Answer 1

command line:

diff --exclude=direxclude -r dir1 dir2

openSUSE 12.1: ok.

sttr@linux-sgfb:/tmp> md dir1
sttr@linux-sgfb:/tmp> md dir2
sttr@linux-sgfb:/tmp> cd dir2
sttr@linux-sgfb:/tmp/dir2> md 10
sttr@linux-sgfb:/tmp/dir2> md 11
sttr@linux-sgfb:/tmp/dir2> md 12
sttr@linux-sgfb:/tmp/dir2> md 14
sttr@linux-sgfb:/tmp/dir2> cd ..
sttr@linux-sgfb:/tmp> cd dir1
sttr@linux-sgfb:/tmp/dir1> md 15
sttr@linux-sgfb:/tmp/dir1> md 11
sttr@linux-sgfb:/tmp/dir1> md 12
sttr@linux-sgfb:/tmp/dir1> md 17
sttr@linux-sgfb:/tmp/dir1> cd ..
sttr@linux-sgfb:/tmp> diff --exclude="11" -r dir1 dir2
Only in dir2: 10
Only in dir2: 14
Only in dir1: 15
Only in dir1: 17
sttr@linux-sgfb:/tmp> diff --exclude=11 -r dir1 dir2
Only in dir2: 10
Only in dir2: 14
Only in dir1: 15
Only in dir1: 17
sttr@linux-sgfb:/tmp>

CentOS 6.3 64: ok.

[root@local tmp]# mkdir dir1
....

Ubuntu 12.04 TLS: ok.

Ubuntu 12.04 TLS

share|improve this answer
    
@STTR sorry but it didn't work –  user35538 Feb 8 '13 at 16:51
    
@user35538 Could you please be more specific? What didn't work, what did you enter? –  Daniel Beck Feb 8 '13 at 17:03
    
diff --exclude="direxclude" -r dir1 dir2 variant? –  STTR Feb 8 '13 at 17:04
    
version OS test? –  STTR Feb 8 '13 at 17:15
    
@STTR Ubuntu 12.04 –  user35538 Feb 8 '13 at 17:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.