Solved

How to AutoGenerate a Directory Structure

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

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

735 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