Code Golf: Directory Tree -> Tree
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;)