The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Finding the time difference padma.raajesh Shell Programming and Scripting 0 02-28-2008 12:12 AM
Recursively copy only specific files from a directory tree sharpsharkrocks Shell Programming and Scripting 3 01-07-2008 02:16 PM
I want to record the difference in the content of files in different directory singhald007 Shell Programming and Scripting 3 02-13-2007 12:28 PM
finding file in a directory legato UNIX for Dummies Questions & Answers 4 01-24-2005 11:27 PM
Finding users currently accesing a directory mehtad Shell Programming and Scripting 3 11-29-2001 03:34 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-09-2008
yayati yayati is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 1
finding difference between 2 directory recursively

Hi,
i'm trying to compare two directories in Unix.
I need a recursive search ie my shell script should also compare common files in those two directory and so on...
any clues.. ??
  #2 (permalink)  
Old 04-09-2008
ShawnMilo ShawnMilo is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 252
Please elaborate as to what your ultimate goal is.

Here's one idea:

For each directory, do a "find ." and save the output to a file. In each file, strip out the first part of the path (which would be different between the two files). Cat the files together, piped to "sort | uniq -c" and save that output.

The result will be that if your output file shows a 1 before the line, then that file exists only in one of the two directories, and if a 2, then it exists in both.

ShawnMilo
  #3 (permalink)  
Old 04-09-2008
denn denn is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 96
do a man for dircmp
Note: you might want to send the output to a file, and also pipe it to uniq to get rid of some of the blank lines.
Code:
dircmp -s /dir1 /dir2 

dircmp -s /dir1 dir2 | uniq > outfile
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:37 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0