?
Solved

How to AutoGenerate a Directory Structure

Posted on 2004-09-29
6
Medium Priority
?
288 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 336 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 332 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 332 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

Technology Partners: 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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

719 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