0

Hi All,

I am trying to compare two folder using "cmp" command.

Folder1=/path/to/folder1
Folder2=/path/to/folder2

Folder1 has file name
abc.txt
efg.txt
hij.txt
.
.
.
.....................
xyz.txt

Folder2 has file name
abc.txt
efg.txt
.
.
.
.....................
xyz.txt


I want to compare this two folder with similar name.
Means Folder1/abc.txt should be comapred with Folder1/abc.txt

similarly

Folder1/xyz.txt should be comapred with Folder1/xyz.txt

The difference should be dump in any file.

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by eggi
0

The 'comm' command allows you to find out
- lines only on the left
- lines only on the right
- lines common

Use this to extract a list of files which are common to both directories.

0

Hey There,

You can also use "diff -r -y" if your version of diff supports it. This will give you output like:

$ ls a b
a:
a b c

b:
a a.gz b b.gz c.gz

$ diff -y -r a b
diff -y -r a/a b/a
Only in b: a.gz
diff -y -r a/b b/b
Only in b: b.gz
Only in a: c
Only in b: c.gz

Just another option if you can use it :)

Best wishes,

Mike

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.