how to control directory permissions with matlab's mkdir command?
<p>matlab's <code>mkdir</code> command seems to always set permissions 755, and the function doesn't seem to accept any options to change this.</p>

<p>It doesn't even seem to respect umask (umask of 2 corresponds to permissions 775 or rwxrwxr-x).</p>

<pre><code>&gt;&gt; !umask
2
&gt;&gt; mkdir /tmp/test
&gt;&gt; ls -l /tmp/
drwxr-xr-x  2 username  groupname          6 Mar 30 10:51 test/
</code></pre>

<p>If I just create one directory, then using <code>fileattrib</code> after the fact is relatively trivial, but if I create a sub-directory e.g. <code>/tmp/test1/test2</code> then matlab's mkdir creates all non-existent parent directories by default. (As if the <code>-p</code> flag had been set for the unix version of mkdir.) If I only want to set the permissions on the new directories, there doesn't seem to be an easy way to tell which parts of the tree are new and which are old.</p>

<p>For the record, I'm using R2014b on linux.</p>