Thread: How to extract a list of files in a specific directory?

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    10

    How to extract a list of files in a specific directory?

    Hello,

    I've started work on a small training project, which basicaly goes like this: You choose a directory and the program populates a list of files IN that directory along with the "Last modified" date. It, basicaly, works like the dir command in the command prompt.

    While I've got the little details sorted out I've got no clue or an intelligent guess of where to start with the files list. I don't know how to extract the first file name, how to get a number of files in that directory, how to cycle the file names, if that's possible - in what order will I get the names. And so on...

    I just need a heap of characters representing the file names (pats would be great too) stored in an accesible format. An explanation would be nice, a point in the right direction (internet tutorial, Borland C++ 5 Builder Help index etc.) would be equaly nice and appreaciated.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There is a FAQ entry for "how do I list files in a directory" or some closely resembling subject.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    10
    Can't... seem to find it...

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    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.

  5. #5
    Registered User
    Join Date
    Oct 2008
    Posts
    10
    Oh this faq, I was looking to the forum one, thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c program to print list of files in a directory
    By leo_1024 in forum Linux Programming
    Replies: 3
    Last Post: 01-24-2009, 05:54 AM
  2. Unknown memory leak with linked lists...
    By RaDeuX in forum C Programming
    Replies: 6
    Last Post: 12-07-2008, 04:09 AM
  3. List files in a directory (without folders)
    By 3saul in forum Linux Programming
    Replies: 4
    Last Post: 04-20-2006, 01:08 AM
  4. list size of files in directory
    By mayhem in forum C Programming
    Replies: 3
    Last Post: 02-27-2005, 11:52 PM
  5. List class
    By SilasP in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2002, 05:20 PM

Tags for this Thread