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
Solved

How to AutoGenerate a Directory Structure

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

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 …
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

808 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