Shell Script to compare folders,Sub-Folders and Sub-Sub-Folders
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i want to compare files from two servers folders ,sub-folders,sub-sub-folders and so on ... i searched through out the forum but i am not getting any satisfactory answer .
Ok, so again, post what you've written, and what you're trying to accomplish, and we can try to help. But, we are NOT going to write your scripts for you. There are many bash scripting guides you can find with a VERY easy Google search, like this:
The diff command can do some parts of what you want, but again, you're not telling us what your goal is. If this is homework, post where you're stuck. If it's for a production environment, there are other tools you can use to do this.
Ok, so again, post what you've written, and what you're trying to accomplish, and we can try to help. But, we are NOT going to write your scripts for you. There are many bash scripting guides you can find with a VERY easy Google search, like this:
The diff command can do some parts of what you want, but again, you're not telling us what your goal is. If this is homework, post where you're stuck. If it's for a production environment, there are other tools you can use to do this.
Hi,
Am trying to achieve like
for Example.
Code:
Serv 1
========
/admin
A
X
Y
B
Z
W
C
/properties
1
4
5
7
12
d
e
/super
22
========
Serv 2
========
/admin
A
X
Y
O
B
Z
W
C
/properties
1
4
5
12
d
e
=============
O/P
-------------
Serv1 Serv2
----------------------------------------------
/admin/A/ 1.)/
------- ------------
missing folder O missing /super folder
2.)/properties/1
----------
missing folder 7
I gathered all the directories from both the servers in text file and am trying to put them in some loop like reading each line .
Code:
line=$1
while read LINE
do
grep the line in both the file and spool into a file.
done < $line
Here am not sure will work or not . will glad if you give some input .
Last edited by unix_72427; 08-08-2012 at 10:56 AM.
Right...we understand what you're trying to do, and have since your first post. What we are asking for is
The code that YOU have written to do this
You to tell us where you're stuck or what problem(s) you're having
What your GOAL is..for example, is this to verify a backup, sync two servers over a WAN...what???
What effort have you put into solving this problem? Is this homework?? Just asking the same question over and over, without answering anyone elses questions won't get you much help....
Right...we understand what you're trying to do, and have since your first post. What we are asking for is
The code that YOU have written to do this
You to tell us where you're stuck or what problem(s) you're having
What your GOAL is..for example, is this to verify a backup, sync two servers over a WAN...what???
What effort have you put into solving this problem? Is this homework?? Just asking the same question over and over, without answering anyone elses questions won't get you much help....
This is not a homework. am trying in production environment to compare two servers and manually fill the gap.
This is not a homework. am trying in production environment to compare two servers and manually fill the gap.
Ok...and how about the other parts of what we've been asking you???
The code that YOU have written to do this
You to tell us where you're stuck or what problem(s) you're having
What effort have you put into solving this problem?
If you're trying to keep two production servers in sync, use rsync, which was suggested to you in the very first reply. Have you looked up the command, and how it's used? This is what it was written for, and (since you say this is not homework), you should be able to use any utility you'd like.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.