Behavior of 'mkdir'

Jaroslav Hajek highegg at gmail.com
Wed Jul 23 08:10:47 CDT 2008


On Wed, Jul 23, 2008 at 11:23 AM, WMennerich <W.Mennerich at gmx.net> wrote:
>
> It depends on what we want to have:
> The octave 'mkdir' is more accurate: If a directory already exists,
> it can not be created. Hence, the behavior of octave seems to me more
> correct.
> If you get a 'true' from 'mkdir' with octave, you know that the directory
> exists and it is empy.
> If you get a 'true' from 'mkdir' with Matlab, you only know, that the
> directory
> exists and you must do an extra check whether it is empty or not.
>
> best, Wolfgang
>
>

I'd like to also notice that Matlab manual states that mkdir returns 1
on success and 0 on failure, so apparently they consider a mkdir of
existing directory as success (but they explain more in the next
paragraph).
In the same situation, GNU's mkdir reports a failure, so I assume
that's what POSIX wants. Can anyone check the Windows MKDIR? I'd
expect the same behaviour. Given that, I think that Octave's way makes
more sense and I'd vote for leaving it as it is.

-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


More information about the Octave-maintainers mailing list