title: Get the entire directory structure of a directory as list
body: <p>So I'm making a GUI which needs a list containing the directory structure of a preconfigured directory. The format could go something like this:</p>
  <pre class="lang-py prettyprint-override"><code>{&quot;base_folder&quot;:
    [
      &quot;file1.txt&quot;,
      &quot;file2.txt&quot;,
      {&quot;directory1&quot;:
        [
          &quot;nested_image.png&quot;,
          {&quot;nested_directory&quot;:
            [
              &quot;deep_video.mp4&quot;,
              &quot;notes.txt&quot;
            ]
          },
          &quot;another_image.png&quot;,
          &quot;not_a_file_type.thisisafile&quot;
        ]
      },
      &quot;game.exe&quot;,
      &quot;mac_port_of_game.app&quot;,    # yeah I know that a .app is a bundle but can't be bothered
                                 # to make the entire bundle structure
      &quot;linux_port_of_game.elf&quot;,
      {&quot;coding_stuff&quot;:
        [
          &quot;code.py&quot;,
          &quot;morecode.c&quot;
        ]
      }
    [
  }
  </code></pre>
  <p>The format doesn't have to be exactly like that, but is there a built in function, maybe in the <code>os</code> module that can do this?</p>