Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu User (http://www.linux-archive.org/ubuntu-user/)
-   -   mkdir: recursive alternative? (http://www.linux-archive.org/ubuntu-user/126679-mkdir-recursive-alternative.html)

"Robert Dailey" 07-17-2008 06:56 PM

mkdir: recursive alternative?
 
Hi,

I'm trying to use mkdir to create something like:

/foo/blah/bar/something

However, 'foo', 'blah', and 'bar' are not guaranteed to exist, so I
need mkdir to recursively create the directories that are not there.
Is there a way to do this? I did a lot of searching on google but I
came up with nothing. Thanks.

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

"Robert Dailey" 07-17-2008 06:57 PM

mkdir: recursive alternative?
 
On Thu, Jul 17, 2008 at 1:56 PM, Robert Dailey <rcdailey@gmail.com> wrote:
> Hi,
>
> I'm trying to use mkdir to create something like:
>
> /foo/blah/bar/something
>
> However, 'foo', 'blah', and 'bar' are not guaranteed to exist, so I
> need mkdir to recursively create the directories that are not there.
> Is there a way to do this? I did a lot of searching on google but I
> came up with nothing. Thanks.
>

Never mind:

mkdir -p

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

"Steve C. Lamb" 07-17-2008 07:06 PM

mkdir: recursive alternative?
 
On Thu, Jul 17, 2008 at 01:57:23PM -0500, Robert Dailey wrote:
> mkdir -p

Personally I go for

import os
os.makedirs('somemultipartpath')

But that's the pythonista in me. ;)

--
Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

"Verde Denim" 07-17-2008 07:21 PM

mkdir: recursive alternative?
 
On Thu, Jul 17, 2008 at 2:56 PM, Robert Dailey <rcdailey@gmail.com> wrote:

Hi,



I'm trying to use mkdir to create something like:



/foo/blah/bar/something



However, 'foo', 'blah', and 'bar' are not guaranteed to exist, so I

need mkdir to recursively create the directories that are not there.

Is there a way to do this? I did a lot of searching on google but I

came up with nothing. Thanks.
if the path is known, something like
for $word in foo blah bar something
do
if [! -d $word]
** mkdir $word
fi
done

(simple bash script)
Jack

*




--

ubuntu-users mailing list

ubuntu-users@lists.ubuntu.com

Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


All times are GMT. The time now is 04:00 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.