Solved

How to AutoGenerate a Directory Structure

Posted on 2004-09-29
6
287 Views
Last Modified: 2013-12-27
Hi all,

would appreciate help here pls..

I have just started working on a software appl. which has indepth directory structure.

Now they have plans to change the directory structure (because they are migrating there appl from WEBLOGIC 6.1 to 8.1 and from webserver from iplanet to sun1 webserver, but I don't even understand there current dir structure.

is there a way/script to autogenerate current directory structure? Ofcourse i can do cd, and keep writing what is in the directory.. but isn't it that there might be some already build tool/script or something, which can probably give directory structure in user friendly way, or a diagram (visio or anything) which can have whole directory structure and may be files in that directory.  

Hope you guys can help me with this migration.
thanks
0
Comment
Question by:hunky_sh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 12

Accepted Solution

by:
stefan73 earned 84 total points
ID: 12180645
Hi hunky_sh,
Yes, you can use
find base_dir -type d

...and you'll get back the entire directory tree. Then you can do some manipulations there, like copying directories only:

cd base_dir ; find * -type d | ( cd target_dir ; xargs mkdir -p )




Cheers!

Stefan
0
 
LVL 34

Assisted Solution

by:PsiCop
PsiCop earned 83 total points
ID: 12180707
More generically, the -p flag on the mkdir command instructs mkdir to also make any intervening directory structure that does not yet exist.

For example, let's say you have /opt/someapp with no subdirs

You want to create /opt/someapp/dir1/alpha and /opt/someapp/dir2/beta

You don't have to create /opt/someapp/dir1 and /opt/someapp/dir2 and then create their individual subdirs. Instead, you could:

# mkdir -p /opt/someapp/dir1/alpha
# mkdir -p /opt/someapp/dir2/beta

The intervening directories ("dir1" and "dir2") will be created automatically.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 83 total points
ID: 12193377
# just a variant of the previous suggestions:

# create dir tree
cd 8.1 && (cd 6.1 && find . -type d)|xargs mkdir -p

# list all files:
cd 6.1 && find . \! -type d -print
0
 
LVL 18

Expert Comment

by:liddler
ID: 12542237
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Points Split  stefan73 {12180645} & PsiCop {12180707} & ahoffmann {12193377}

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

liddler
EE Cleanup Volunteer
0
 
LVL 34

Expert Comment

by:PsiCop
ID: 12544575
Fine by me
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question