Solved

How to AutoGenerate a Directory Structure

Posted on 2004-09-29
6
280 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
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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.:

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now