G
George Mpouras
I want to build an array of arrays from a random tree data structure.
for example if d... means "directory" and f... "file"
then from the data
/d1/d7/d8
/d1/d2/f1
/d1/d2/f2
/f1
/f2
/d1/f1
/d2/f3
/d4/d6/f1
The following array must be created. Any idea is wellcome.
[d1,
[d7,
[d8
],
[d2,
[f1],
[f2],
],
[f1],
],
[f1],
[f2],
[d2,
[f3],
],
[d4,
[d6,
[f1]
]
]
for example if d... means "directory" and f... "file"
then from the data
/d1/d7/d8
/d1/d2/f1
/d1/d2/f2
/f1
/f2
/d1/f1
/d2/f3
/d4/d6/f1
The following array must be created. Any idea is wellcome.
[d1,
[d7,
[d8
],
[d2,
[f1],
[f2],
],
[f1],
],
[f1],
[f2],
[d2,
[f3],
],
[d4,
[d6,
[f1]
]
]