Code Golf: Directory Tree -> Tree Contest (!): In the language of your choice, write a program that will traverse the directory tree of a given directory and output a tree (i.e., an array of arrays) corresponding to it. Assume the directory is a predefined variable D. Smallest character count wins.

Rules:


You must use recursion
See Rules


Note: Assume that there are no recursion depth limits. In other words, your code just needs to work for sufficiently small directory trees, and in principle for larger ones.

For instance:

Directory tree is 

dir1
├── dir11
│   ├── file111
│   └── file112
├── dir12
│   ├── file121
│   ├── file122
│   └── file123
├── file11
├── file12
└── file13


Output tree is

[[[],[]],[[],[],[]],[],[],[]]


First code golf here so lemme know if I'm doing something wrong.

Have fun :)
Mathematica 120 21 20

Explicit recursion (thanks alephalpha for saving one char):
f=f/@__~FileNames~#&amp;

f[&quot;~/StackExchange/dir1&quot;]


{{{}, {}}, {{}, {}, {}}, {}, {}, {}}

TreeForm[%]


Previous overcomplicated solution:
d=&quot;~/StackExchange/dir1&quot;

f@{x___,Longest@s:{y_,___}..,z___}:=f@{x,f@Drop[{s},1,1],z}
f[FileNameSplit/@FileNames[__,SetDirectory@d;&quot;&quot;,∞]]/.f-&gt;(#&amp;)