mkdir and nested folders.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

mkdir and nested folders.

Laurent Hoeltgen
Hi.

The following works in Matlab R2012a on Xubunu 12.04:

mkdir('foo/bar/baz')

when the folders foo and bar don't exist. They are simply created then,
too. However on octave (3.6.2) it doesn't. Status is 0.

Is there any way to get the same behaviour in octave as in matlab?

Regards,
Laurent
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: mkdir and nested folders.

Andreas Weber-2
On 18.12.2012 07:47, Laurent Hoeltgen wrote:
> The following works in Matlab R2012a on Xubunu 12.04:
> mkdir('foo/bar/baz')
> when the folders foo and bar don't exist. They are simply created
> then, too. However on octave (3.6.2) it doesn't. Status is 0.

Hi Laurent,
I think this is related to
http://lists.gnu.org/archive/html/bug-gnulib/2012-06/msg00034.html
octave uses gnulib::mkdir. There is also a gnulib::mkdir-p but as you
see in the link above this made some problems compiling with MinGW.

> Is there any way to get the same behaviour in octave as in matlab?
You can do 'system("mkdir -p foo/bar/baz")' but this isn't platform
independent.

Regards, Andy
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: mkdir and nested folders.

Carnë Draug-2
In reply to this post by Laurent Hoeltgen
On 18 December 2012 06:47, Laurent Hoeltgen <[hidden email]> wrote:
> Hi.
>
> The following works in Matlab R2012a on Xubunu 12.04:
>
> mkdir('foo/bar/baz')
>
> when the folders foo and bar don't exist. They are simply created then, too.
> However on octave (3.6.2) it doesn't. Status is 0.

Yes. See https://savannah.gnu.org/bugs/?func=detailitem&item_id=30650

> Is there any way to get the same behaviour in octave as in matlab?

On comment #11 of that bug report there's an ugly hack for it. It
basically shadows core mkdir with a recursive call to core mkdir.

Carnë
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: mkdir and nested folders.

Laurent Hoeltgen
In reply to this post by Andreas Weber-2
On 18/12/12 08:28, Andreas Weber wrote:

> On 18.12.2012 07:47, Laurent Hoeltgen wrote:
>> The following works in Matlab R2012a on Xubunu 12.04:
>> mkdir('foo/bar/baz')
>> when the folders foo and bar don't exist. They are simply created
>> then, too. However on octave (3.6.2) it doesn't. Status is 0.
>
> Hi Laurent,
> I think this is related to
> http://lists.gnu.org/archive/html/bug-gnulib/2012-06/msg00034.html
> octave uses gnulib::mkdir. There is also a gnulib::mkdir-p but as you
> see in the link above this made some problems compiling with MinGW.
>
>> Is there any way to get the same behaviour in octave as in matlab?
> You can do 'system("mkdir -p foo/bar/baz")' but this isn't platform
> independent.
>
> Regards, Andy
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave

Hi,

for the time being, I think I can live with

system("mkdir -p foo/bar/baz"),

Thanks for the help.

Regards,
Laurent
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave