In ubuntu 12.04, I used the "#include dirent.h" interface to access functions (like opendir(), closedir(), readdir() etc.) and constants for this effort.
With these, my program can read dirs and pfns starting at a directory. (But you don't want to start at dir "/", and there are several dir's you should skip.)
At a terminal, try man opendir.
I have only used this on Linux (specifically ubuntu 12.04 and a few earlier versions of ubuntu.)
"dirent.h" does fairly well on NTFS, but NTFS has some interesting kludges I no longer wish to work on.
Good luck.