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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
directory tree ravi raj kumar Shell Programming and Scripting 3 01-24-2008 10:08 AM
Searching directory tree blane Shell Programming and Scripting 7 05-29-2007 04:30 PM
directory as tree anything2 High Level Programming 2 03-01-2007 06:38 AM
Production Directory Structures jbrubaker UNIX for Dummies Questions & Answers 6 07-11-2006 07:18 AM
Directory tree search??? solvman High Level Programming 3 09-28-2001 10:27 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 10-21-2005
Registered User
 

Join Date: Oct 2005
Posts: 5
help:comparing two directory tree structures only

Hi

I what, a script snippet for "comparing two directory tree structures only " not the contents of directories(like files..etc).

Thanking you a lot.

Regards
Rajesh
Reply With Quote
Forum Sponsor
  #2  
Old 10-21-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Please share with us what you have done so far, and let us take a look at your current script that you've attempted to write to solve this problem yourself.

Cheers
ZB
Reply With Quote
  #3  
Old 10-21-2005
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,235
If I solve it for you, will i get your mark in computer science in return?

And if i don't, will i have to do the imposition for not doing the homework assignment instead?

bakunin
Reply With Quote
  #4  
Old 10-21-2005
Registered User
 

Join Date: Oct 2005
Posts: 5
i done with this code but it is displaying the contents of directories as well..i want to test only directory tree structures...

the code is here:

#!/bin/sh
dircmp -s -w 200 $1 $2 > $3
grep -v $1 $3 > tmp
# this line is for deleting page headers
echo "files only in directory $1:" > `basename $1`.dir1
echo "files only in directory $2:" > `basename $2`.dir2
cut -f1 tmp >> `basename $1`.dir1
cut -f2 tmp >> `basename $2`.dir2
uniq `basename $1`.dir1 | sed -e '/^$/d' > `basename $1`.output1
uniq `basename $2`.dir2 | sed -e '/^$/d' > `basename $2`.output2
#this line is for deleting blank lines present in output file


so can one tell wht changes should be made to the code so taht it can only check the two directory tree structures??

thanks a lot..
Regards
Rajesh
Reply With Quote
  #5  
Old 10-21-2005
Registered User
 

Join Date: Sep 2005
Posts: 36
Hope this helps

Why do you need to do this ????
ls -l dir2 | grep ^d |awk '{print }' |tee a| ls -l dir1 | grep ^d |awk '{print }
' |tee b|diff a b
~
rm a b

---
ls dir1
d1 d2 test1
test1 is a file
ls dir2
d1 d2 dir3 dir4 yy
yy is a file

Output
====
3,4d2
< dir3
< dir4
Reply With Quote
  #6  
Old 10-24-2005
Registered User
 

Join Date: Oct 2005
Posts: 5
help:comparing two directory tree structures only

Hi every one,
Akriti --> what You have said is correct and Thanx for your reply.

but what I want is to even check the subdiretories present in those directories and compare them..what you are showing is only of one level..I want to check two directory tree structures i.e. all the levels present inside those two directories. I want this to check is the newly updated files should be of same directory structure as of previous version.

aaiting for your reply soling my problem.

Thanking you alot
rajesh
Reply With Quote
  #7  
Old 10-24-2005
Registered User
 

Join Date: Oct 2005
Posts: 5
help:comparing two directory tree structures only

Hi every one,
Akrathi --> what You have said is correct and Thanx for your reply.

but what I want is to even check the subdiretories present in those directories and compare them..what you are showing is only of one level..I want to check two directory tree structures i.e. all the levels present inside those two directories. I want this to check is the newly updated files should be of same directory structure as of previous version.
aaiting for your reply soling my problem.

Thanking you alot
rajesh
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:59 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0