How do you put all the names of sub-directories within a directory into a structure file?

I’m trying to make a level creator and all the levels go into a folder when downloaded from the Steam Workshop. How would I enter the main folder and get the names of the sub-folders so I can add them as children in an array variable?