Thread: c program to print list of files in a directory

  1. #1
    Registered User
    Join Date
    Dec 2008

    c program to print list of files in a directory

    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?

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Well, to start with, look up readdir(3) in your manpages, as well as opendir.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Or even the FAQ
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Oct 2008
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. List all system and program files
    By tnbui in forum Windows Programming
    Replies: 7
    Last Post: 07-10-2009, 02:43 AM
  2. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 10:10 AM
  3. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  4. Adding directory/file names to a linked list
    By thoseion in forum C Programming
    Replies: 13
    Last Post: 12-08-2006, 01:13 PM
  5. I Need To Know Some Things That I Can Put Into A Batch File
    By TheRealNapster in forum A Brief History of
    Replies: 1
    Last Post: 10-20-2003, 08:12 PM