The UNIX and Linux Forums  


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
Search attributes in one structure using the values from another structure dhanamurthy High Level Programming 3 03-27-2008 03:37 AM
File Comparison net_shree Shell Programming and Scripting 19 01-10-2008 08:00 PM
file structure yoavbe Shell Programming and Scripting 7 10-16-2007 07:27 AM
TAR only the file structure Andysundar UNIX for Dummies Questions & Answers 1 10-13-2005 05:06 PM
Copying a Directory Structure to a new structure jhansrod UNIX for Dummies Questions & Answers 8 07-27-2005 07:24 AM

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

Join Date: Sep 2006
Location: Mysore, India
Posts: 191
File structure comparison

To test server migration, we need to compare files under a directory in source and target servers.


I need to verify if the below two directories on two servers are identical (i.e., contains same directories and files with same size. They may have multiple level sub-directories)

//SourceServer/project1/nesteddir
//TargetServer/project1/nesteddir

Has anyone done a similar stuff?

The output of diff command is quite complex to understand. Is there any other simple way?
  #2 (permalink)  
Old 07-07-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,289
Do on both servers/directories something like for example:
Code:
find . -exec ls -la {} \;| awk '$NF !~ /^\.$|^\.\.$/ {print $5,$NF}' > outfile1
For $5 you have to check which position your filesize will be when you do a ls -l, ie. if it's the 5th column like in my example.
And then compare both with diff like
Code:
diff outfile1 outfile2
  #3 (permalink)  
Old 07-07-2008
krishmaths krishmaths is offline
Registered User
  
 

Join Date: Sep 2006
Location: Mysore, India
Posts: 191
Thanks zaxxon, but the problem is in using diff command. I need a simple output like

The following files are in serverA but no in serverB :

The following files names are common to serverA and serverB, but contents differ:

Thanks again for your response.
  #4 (permalink)  
Old 07-07-2008
drl's Avatar
drl drl is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 712
Hi.

If you are on Solaris, there is a script dircmp that may be useful:
Code:
dircmp - no version provided for /usr/bin/dircmp.
And otherwise, there is a script at: Unix Review > The Shell Corner: cmptree that discusses a similar script.

Because both are scripts, you and your colleagues can modify them to suit your purposes ... cheers, drl

Last edited by drl; 07-07-2008 at 02:22 PM.. Reason: Make URL a live link.
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 11:09 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