title: Adding files in subfolders to sphinx documentation (sphinxcontrib-matlabdomain)
body: <p>I have a directory containing various folders, with each of them having matlab source files in them. Some of these folders have sub-folders containing matlab source files.</p>
  
  <p>How can I create a TOC tree with Sphinx to contain the sub-folders in a nested way?</p>
  
  <p>For example, when <code>Main-Directory</code> contains <code>conf.py</code>, <code>index.rst</code>, and <code>moduleslist.rst</code> along with the following folder structure:</p>
  
  <pre><code>    Folder1
          abc.m
          def.m
      Folder2
          Folder2.1
              ghi.m
          jkl.m
  </code></pre>
  
  <p>with this <code>index.rst</code> file:</p>
  
  <pre><code>.. toctree::
      :maxdepth: 1
  
      moduleslist
  </code></pre>
  
  <p>and this <code>moduleslist.rst</code> file:</p>
  
  <pre><code>.. toctree::
      :maxdepth: 2
  
  Folder1
  =========
  .. automodule:: Folder1
  :members:
  
  Folder2
  =========
  .. automodule:: Folder2
      :members:
  </code></pre>
  
  <p>But this does not include the sub-folder <code>Folder2.1</code> and files in it. I have tried adding <code>Folder2/index</code> in <code>index.rst</code>, with the <code>Folder2/index.rst</code> containing the automodule for <code>Folder2.1</code>, which didn't include documentation of <code>ghi.m</code>.</p>
  
  <p><strong>How can I get Sphinx to show nested sub-folders in it's TOC tree?</strong></p>