help:comparing two directory tree structures only


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help:comparing two directory tree structures only
# 1  
Old 10-21-2005
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
# 2  
Old 10-21-2005
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
# 3  
Old 10-21-2005
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
# 4  
Old 10-21-2005
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
# 5  
Old 10-21-2005
Hope this helps

Why do you need to do this ???? Smilie
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
# 6  
Old 10-24-2005
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
# 7  
Old 10-24-2005
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Specific directory parsing in a directory tree

Hi friends, Hello again :) i got stuck in problem. Is there any way to get a special directory from directory tree? Here is my problm.." Suppose i have one fix directory structure "/abc/xyz/pqr/"(this will be fix).Under this directory structure i have some other directory and... (6 Replies)
Discussion started by: harpal singh
6 Replies

2. UNIX for Dummies Questions & Answers

directory tree with directory size

find . -type d -print 2>/dev/null|awk '!/\.$/ {for (i=1;i<NF;i++){d=length($i);if ( d < 5 && i != 1 )d=5;printf("%"d"s","|")}print "---"$NF}' FS='/' Can someone explain how this works..?? How can i add directory size to be listed in the above command's output..?? (1 Reply)
Discussion started by: vikram3.r
1 Replies

3. UNIX for Dummies Questions & Answers

Delete duplicate files from one of two directory structures

Hello everyone, I have been struggling to clean up a back-up mess I created when manually duplicating a directory structure and then working in both of them.. The structures now are significantly different and contain in the order of 15 k files of which most are duplicates. Now I am trying to... (0 Replies)
Discussion started by: procreator
0 Replies

4. Shell Programming and Scripting

creating a directory tree

Hi all, I'd like to create a directory tree, and define from stdin how many levels deep and how many directories in each level should be created. What I wrote does not work properly:#!/bin/bash #set -x read -p " What root directory? " rootDir && { /bin/rm -R $rootDir; mkdir $rootDir; } ||... (2 Replies)
Discussion started by: NBaH
2 Replies

5. UNIX for Dummies Questions & Answers

Production Directory Structures

We (our company) has just purchased a new IBM unix machine. We have been doing some research and have found that it is NOT a good idea to put your own in-house-written applications under the existing file folders such as /usr or /bin ect. Instead you should place these applications in directories... (7 Replies)
Discussion started by: jbrubaker
7 Replies

6. UNIX for Dummies Questions & Answers

Move all files in a directory tree to a signal directory?

Is this possible? Let me know If I need specify further on what I am trying to do- I just want to spare you the boring details of my personal file management. Thanks in advance- Brian- (2 Replies)
Discussion started by: briandanielz
2 Replies

7. Shell Programming and Scripting

directory tree

Hi all, The following is a script for displaying directory tree. D=${1:-`pwd`} (cd $D; pwd) find $D -type d -print | sort | sed -e "s,^$D,,"\ -e "/^$/d"\ -e "s,*/\(*\)$,\:-----\1,"\ -e "s,*/,: ,g" | more exit 0 I am trying to understand the above script.But... (3 Replies)
Discussion started by: ravi raj kumar
3 Replies

8. Programming

directory as tree

hi i have modified a program to display directory entries recursively in a tree like form i need an output with the following guidelines: the prog displays the contents of the directory the directory contents are sorted before printing so that directories come before regular files if an entry... (2 Replies)
Discussion started by: anything2
2 Replies

9. Filesystems, Disks and Memory

Space Used by Directory Tree

Can someone tell me how I can determine how much space (blocks) have been used by a given directory tree? I periodically need to know how much space is consumed by a directory and all of its files and subdirectories and their files in either KB or blocks. I have tried df and du but these do not... (1 Reply)
Discussion started by: johnk99
1 Replies

10. Programming

Directory tree search???

Hi all, I've got a problem, what function do i use to list the contents of all the directory tree (simular to "find")? Any other suggestions? Thank you all (3 Replies)
Discussion started by: solvman
3 Replies
Login or Register to Ask a Question