View Full Version : c program to print list of files in a directory

01-18-2009, 06:14 AM
Hi friends,

i want a program to print all the files in a directory recursively without using ls command and system command. Any body have idea let me know?

01-18-2009, 07:00 AM
Well, to start with, look up readdir(3) in your manpages, as well as opendir.

01-18-2009, 07:10 AM
Or even the FAQ

01-24-2009, 05:54 AM
You can do it using FTW (file tree walk), do man ftw to get more details. using the api ftw, u can give the directory name and a pointer to a function, in the function use must print the file name. It is very easy. hope this will help you.