LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mkdir options (https://www.linuxquestions.org/questions/linux-newbie-8/mkdir-options-495416/)

sravanth.svk 10-25-2006 08:21 AM

mkdir options
 
Hi every one,

I would like to know that is there any option to simplify
The usage of -p option in mkdir command
Ex:- mkdir -p dir1/sdir1 dir1/sdir2 dir1/sdir3 dir1/sdir1/csdir1 dir1/sdir1/csdir2

It might even extend on requirement so it would be better to have a bit simplified command using whilchord characters or any other thing

Thanking you all
sravanth.svk

kenjoy 10-25-2006 12:02 PM

make clear ur thoughts, so we can help.

Tinkster 10-25-2006 12:29 PM

Quote:

Originally Posted by sravanth.svk
Hi every one,

I would like to know that is there any option to simplify
The usage of -p option in mkdir command
Ex:- mkdir -p dir1/sdir1 dir1/sdir2 dir1/sdir3 dir1/sdir1/csdir1 dir1/sdir1/csdir2

It might even extend on requirement so it would be better to have a bit simplified command using whilchord characters or any other thing

Thanking you all
sravanth.svk

You could conceivably write a wrapper that takes the to
be newly created dir1 as the first parameter, and omit it
in the following .... but that's as good as it gets because the
script can't conceivably know on which level to create which
directory.


Cheers,
Tink

penguin_powered 10-25-2006 01:29 PM

You're making it more complicated than it is.

No need for those short directory references when you're going to do this:

mkdir -p dir1/sdir1/csdir1 dir1/sdir1/csdir2

Pick your longest paths and put those in a simple text file and execute it.

Exactly how many layers do you want to create? This could be a fun challenge to write the smallest script to get the job done.

kenjoy 10-26-2006 12:31 AM

Sure, u can process it with this small script, but every time u need create the small script by hand.

Quote:

Originally Posted by penguin_powered
You're making it more complicated than it is.

No need for those short directory references when you're going to do this:

mkdir -p dir1/sdir1/csdir1 dir1/sdir1/csdir2

Pick your longest paths and put those in a simple text file and execute it.

Exactly how many layers do you want to create? This could be a fun challenge to write the smallest script to get the job done.



All times are GMT -5. The time now is 03:35 AM.