# School Computer Project.. searching directories?



## karmanya (Nov 23, 2009)

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?


----------



## harryneopotter (Nov 23, 2009)

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:



> Void search(string path)
> {
> .....  use ur code to search for subdirectories.....
> and then for each of the subdirectories found .....
> ...


-----------------------------------------
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:



> Void search(string path)
> {
> .....  use ur code to search for subdirectories.....
> and then for each of the subdirectories found .....
> ...


----------



## gopi_vbboy (Nov 23, 2009)

write a progam to genrate sine wave


----------



## karmanya (Nov 24, 2009)

@harryneopotter Erm, how exactly do i scan for directories? Since find_next and find_first don't even pick them up.


----------



## vandit (Dec 28, 2009)

*www.devarticles.com/c/a/Cplusplus/Directories-in-Cplusplus/2/

this might be of some help. And I recollect there is some funtion by a similar name to what you said.. sorry dont have the access to turbo c manuals currently..


----------



## aniket.awati (Dec 28, 2009)

run command line dir *.txt *.pdf /s >new.txt from c.


----------

