I previously posted an MS-Windows example program about how to recursively search folders and create a list of their filename. This program is similar in concept but is for linux. It c++ and uses std::string and std::vector classes to hold the strings. When the program encounters a directory it will recursively call itself to process that directory. All the directory names are placed into a vector of vectors.
One improvement that needs to be made if using this program is to maintain the names of the directories along with the vector or filenames.