03-27-2016
Comparing 2 UNIX directories
Hello,
I'd want to compare the content of 2 directories in unix.
I use the diff command like this:
diff /home/user/AAAAA /home/user/BBBBB
It works fine, but when a same file is in both directories and they are diferents, I'd want to see only that it is diferent and not all diferencies.
I tried:
diff -c but it doesn't works.
Could anyone help me please ?
thanks in advance
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello!
I am trying to compare a list of files in 2 directories - one on our unix server (I'll call it 'ours') and one on a site we ftp to (I'll call it 'ftp'). I need to make sure that after we ftp, the names that we put out there match the names we have on our side. I was thinking to create a... (1 Reply)
Discussion started by: tekster757
1 Replies
2. UNIX for Dummies Questions & Answers
Hello
I want to compare the content of two directories recursively to check if the two directories have the same files. How can I do that? (2 Replies)
Discussion started by: xyzt
2 Replies
3. Shell Programming and Scripting
Is it possible to use the diff command to compare two directories on different Unix (AIX) servers?
We have two regions set up and we want to be able to compare if the scripts directory in both regions contain the same files?
I want to figure out if its possible.. Have been messing around by... (10 Replies)
Discussion started by: Jazmania
10 Replies
4. Homework & Coursework Questions
i have been asked to write a bash shell script comparing two directories and sed or awk should not be used in this assignment. compdir will compare filenames in two directories, and list information about filenames that are in one directory but not the other. The information listed will be a long... (1 Reply)
Discussion started by: soccerball
1 Replies
5. Shell Programming and Scripting
Hi
Is it possible to compare the modified dates of all the files in two directories using shell script?
I would like to take a backup of a directory in production server regularly.
Instead of copying all the files in the directory, is it possible to list only the files that are... (2 Replies)
Discussion started by: ashok.k
2 Replies
6. Shell Programming and Scripting
Hello all,
I need to write a script which has following requirement:
Need to read the filenames from text file and then search for the above read files in the required directory and if match found backup them in a backup folder.
And also need to compare and verify whether the files in the... (7 Replies)
Discussion started by: saurau
7 Replies
7. Shell Programming and Scripting
Hi,
I have got a requirement for which i need your help. The following problem is required to get solved in PERL SCRIPT. Here is the requirement.
There are 4 folders say SRC_DIR1, SRC_DIR2 and TGT_DIR_1,TGT_DIR_2
(Note: both path of SRC_DIR1 & SRC_DIR2 are different but both path of... (1 Reply)
Discussion started by: shadow_fawkes
1 Replies
8. Shell Programming and Scripting
Hi,
I have got a requirement for which i need your help. The following problem is required to get solved in PERL SCRIPT. Here is the requirement.
There are 4 folders say SRC_DIR1, SRC_DIR2 and TGT_DIR_1,TGT_DIR_2
(Note: both path of SRC_DIR1 & SRC_DIR2 are different but both path of... (4 Replies)
Discussion started by: shadow_fawkes
4 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I am planning to automate the comparison of data between few tables in 2 different databases ( Teradata and sql server).
Below is the approach which I think of. Please suggest any improvements/Modification :
1) The sql server file is having more records and I have to eliminate the... (5 Replies)
Discussion started by: Rahul Raj
5 Replies
10. Shell Programming and Scripting
Hi all,
I have 2 directories on two different servers. I am trying to find out what is missing from directory X and what is missing from directory Y. they should both have the same exact files in them.
I understand some files may be missing from both directories on each server. I am not sure... (8 Replies)
Discussion started by: jeffs42885
8 Replies
dircmp(1) General Commands Manual dircmp(1)
NAME
dircmp - Compares two directories
SYNOPSIS
dircmp [-d] [-s] directory1 directory2
The dircmp command reads directory1 and directory2, compares their contents, and writes the results to standard output.
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
dircmp: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
Displays for each common file name the differing contents of the two files, if any. The display format is the same as that of the diff
command. Does not list the names of identical files.
OPERANDS
The path name of a directory to be compared.
DESCRIPTION
First, dircmp compares the file names in each directory. When the same file name appears in both, dircmp compares the contents of the two
files.
In the output, dircmp lists the files unique to each directory. It then lists the files with identical names but different contents. If
entered without a option, dircmp also lists files that have both identical names and identical contents.
NOTES
[Tru64 UNIX] In many cases, diff -r, rather than dircmp, is preferred. The dircmp command is marked LEGACY. The diff -r command should
be used instead.
EXAMPLES
To summarize the differences between the files in two directories, enter: dircmp proj.ver1 proj.ver2
This displays a summary of the differences between the directories proj.ver1 and proj.ver2. The summary lists separately the files
found only in one directory or the other, and those found in both. If the file is found in both directories, the file is listed.
If the files are identical, dircmp displays identical; otherwise, dircmp displays different. To show the details of the differences
between files, enter: dircmp -d -s proj.ver1 proj.ver2
The -s option suppresses information about identical files. The -d option displays a diff listing for each of the differing files
found in both directories.
SEE ALSO
Commands: cmp(1), diff(1)
Standards: standards(5)
dircmp(1)