1832155 Members
3460 Online
110038 Solutions
New Discussion

Re: directory structure

 
Bernard  Bravo
Advisor

directory structure

Hi,

I need some help on this..

I need to list all the directory trees inside a directory...Is there any command combination to get this... I want to copy the structure to another environment...

thanks in advance..

bernard
Do good, Look Good, Feel Good
6 REPLIES 6
Steven Sim Kok Leong
Honored Contributor

Re: directory structure

Hi,

# find . -type d -print

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Michael Tully
Honored Contributor

Re: directory structure

Hi,

You need to change directory to the tree
that you wish to start.

# find . -type d -print >/tmp/dir.out

HTH
-Michael
Anyone for a Mutiny ?
Hartmut Lang
Trusted Contributor

Re: directory structure

For copying a whole directory tree to another machine i use:

tar cf - | remsh "cd ; tar xvf -"
Wodisch
Honored Contributor

Re: directory structure

Hello Bernard,

if it only about copying a directory-tree, why not using "rcp -rp SOURCE TARGET", where SOURCE and TARGET are in the form of "[host:]directory"?

Just my $0.02,
Wodisch
Suhas_3
Advisor

Re: directory structure

Hi,

If you are interested in copying the directory structure only, and not the files then this may help -
find -type d | remsh " cd ; xargs mkdir -p $1"

Thanks,
Suhas
Paula J Frazer-Campbell
Honored Contributor

Re: directory structure

Hi

A nice routine from JRF :-

# dtree : print a hierarchy tree starting at specified directory
# (.default)

(cd ${1-.};pwd);
find ${1-.} -type d -print | sort -f | sed -e "s,^${1-.},," -e "/^$/d" -e "s,[^/
]*/\([^/]*\)$,\`-------\1," -e "s,[^/]*/,| ,g"
#
HTH

Paula
If you can spell SysAdmin then you is one - anon