School Computer Project.. searching directories?

Discussion in 'Programming' started by karmanya, Nov 23, 2009.

Thread Status:
Not open for further replies.
  1. karmanya

    karmanya New Member

    Joined:
    Sep 6, 2005
    Messages:
    227
    Likes Received:
    0
    Trophy Points:
    0
    Hey,
    Im in class 12 right now (read : excuse for my inactivity) and I thought that for my board project, I'd end up making an ebook library, mostly because I really need one. One of the things that I need this program to do is to search/scan the computer for all pdf,lit,txt,doc etc etc files (a la, Mediamonkey or iTunes) and write their names and paths to a file. Now I'm pretty sure I can use normal fstream for the writing bit, but I can't find a function to search the computer- findnext and findfirst (from the turbo c++ help files) don't search sub-directories within the ones that i specify for example if i were to say search C:\ it won't look up C:\docs.
    Is there anyway around this?
     
  2. harryneopotter

    harryneopotter Member

    Joined:
    Feb 8, 2007
    Messages:
    960
    Likes Received:
    3
    Trophy Points:
    18
    Write a Function which takes a directory path ("C:\", or C"\Docs") as argument and then scans the directory and get a list of all the subdirectories. Then recursively call the same function for each of the subdirectories found.

    this method will do IMO !!

    Example Code:

    -----------------------------------------
    Posted again:
    -----------------------------------------
    Write a Function which takes a directory path ("C:\", or C"\Docs") as argument and then scans the directory and get a list of all the subdirectories. Then recursively call the same function for each of the subdirectories found.

    this method will do IMO !!

    Example Code:

     
    Last edited: Nov 23, 2009
  3. gopi_vbboy

    gopi_vbboy New Member

    Joined:
    Mar 1, 2007
    Messages:
    1,452
    Likes Received:
    9
    Trophy Points:
    0
    Location:
    Hyderabad
    write a progam to genrate sine wave
     
  4. OP
    OP
    karmanya

    karmanya New Member

    Joined:
    Sep 6, 2005
    Messages:
    227
    Likes Received:
    0
    Trophy Points:
    0
    @harryneopotter Erm, how exactly do i scan for directories? Since find_next and find_first don't even pick them up.
     
  5. vandit

    vandit New Member

    Joined:
    May 31, 2005
    Messages:
    458
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    If I had a webcam u could have seen me, before you
  6. aniket.awati

    aniket.awati I am the Legend.........

    Joined:
    Aug 3, 2006
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    sangli
    run command line dir *.txt *.pdf /s >new.txt from c.
     
Thread Status:
Not open for further replies.

Share This Page