You are not logged in.

#1 2007-02-24 11:08:15

curana
Member
From: Switzerland
Registered: 2006-04-14
Posts: 97
Website

Software to compare folder structure

Hi,
Good news: Im back :-)
Hm, seems nobody recognized I was gone for a while... ;-)

OK, here is my "problem":

Im searching for a tool which can compare folderstructures. Reason: I want to chroot some services (Apache etc) but dont want to check for each dependency. So I want to compare the situation before and after a normal installation to check which files have to be symlinked or copied to the chroot folder.

Any hints how to solve this problem?

Offline

#2 2007-02-24 13:07:47

smoon
Member
Registered: 2005-08-22
Posts: 468
Website

Re: Software to compare folder structure

You could just check out the contents of the package and the packages install file (if any) to see what files get created, modified, etc.
Another way would be using rsync with the --dry-run option.

Offline

#3 2007-02-24 13:33:22

curana
Member
From: Switzerland
Registered: 2006-04-14
Posts: 97
Website

Re: Software to compare folder structure

I am looking for a unix-wide solution, not arch specific. I should have mentioned this.

I will check out rsync. What tools do you use for chrooting?

Offline

#4 2007-02-25 11:09:11

mr_echo
Member
Registered: 2005-03-28
Posts: 25

Re: Software to compare folder structure

You can use diff to compare two different directories:
# diff -rq <dir1> <dir2>

Dunno if thats something that could be used in your case.

Or can't you just use find or something to dump the file structure to a file before and after the installation and then just diffing the files?

Last edited by mr_echo (2007-02-25 11:23:50)

Offline

#5 2007-02-25 11:46:41

billy
Member
From: Slovenia
Registered: 2006-09-13
Posts: 164

Re: Software to compare folder structure

mr_echo wrote:

Or can't you just use find or something to dump the file structure to a file before and after the installation and then just diffing the files?

hmmmm....what about

find . -name "*" > structure.[before/after]

Offline

#6 2007-02-25 11:48:38

Pajaro
Member
Registered: 2004-04-21
Posts: 884

Re: Software to compare folder structure

This returns a list of files with all the information:

find -exec ls -l {} \;|sed 's/^total [0-9]*$//g'

I don't know how to avoid the blank lines.

run this before,

find -exec ls -l {} \;|sed 's/^total [0-9]*$//g' > files_before

run this after,

find -exec ls -l {} \;|sed 's/^total [0-9]*$//g' > files_after

run diff

diff files_before files_after

This may be a start point for a bash script.

Offline

#7 2007-02-25 12:10:45

curana
Member
From: Switzerland
Registered: 2006-04-14
Posts: 97
Website

Re: Software to compare folder structure

Wow, cool ideas. Thanks a lot.

I guess I will make a script out of ur samples. I totally forgot the POWER OF SHELLS ;-)

You found what I needed! Great.

Offline

#8 2007-02-25 15:52:19

drakosha
Member
Registered: 2006-01-03
Posts: 253
Website

Re: Software to compare folder structure

meld knows how to cmp directories... but's it's gui tool

Offline

#9 2007-02-25 15:56:28

curana
Member
From: Switzerland
Registered: 2006-04-14
Posts: 97
Website

Re: Software to compare folder structure

I need it for server usage. No graphics on servers ;-)

Offline

#10 2007-02-26 05:31:14

sincity
Member
Registered: 2005-12-15
Posts: 63

Re: Software to compare folder structure

Pajaro wrote:

This returns a list of files with all the information:

find -exec ls -l {} \;|sed 's/^total [0-9]*$//g'

I don't know how to avoid the blank lines.

sed '/^$/d'

Offline

#11 2007-02-26 06:32:12

Pajaro
Member
Registered: 2004-04-21
Posts: 884

Re: Software to compare folder structure

thanks sincity,

so the line ends up like this:

find -exec ls -l {} \;|sed 's/^total [0-9]*$//g'|sed '/^$/d'

Offline

Board footer

Powered by FluxBB