Directory structure to nested array

Here is an interesting method for creating a nested array based on the directory structure of a list of URLs.