You can call a UNIX command from C using the 'system' function. However, the only thing the program you call can return to your program is a integer to indicate success or failure of the command.
To read in a command from UNIX, you can use the popen function to call a program & read its output.
But then, the most efficient way to do this in UNIX is to make some OS calls to read a directory. The functions opendir, readdir, and closedir will do what you want.
Of course, what kind of UNIX hack would I be if I didn't mention shell scripts. Many things that you want to do in UNIX can be handled via shell scripts. Writing a shell script using cut, sed, or awk is a great way to get things done.