Wow, I first answered that thread 3 years ago. ;-)
I would think, out of my head, that if you get the content of a given directory, you can identify if each file is a directory or a normal file. You pass a pointer to (or the reference of) a container (a list, a map, even a stack) while cat'ting the path of the directories or file and accumulating file names into it.
void GetDirContent(current_dir, ptr_to_container)
list = GetListofFiles(current_dir)
for each member of the list
new_name = concatenate member to current_dir (with an extra slash /)
if member is a directory
Once the recursion stops, it unrolls back with a container filled with file names.
Don't forget to ignore . and .. directories - which readdir() usually returns.