How to list all files in harddisk

Recommended Answers

All 5 Replies

cd \
dir /s

:)

How do you want the files? Name only or with path. What os are you using?

i need c++ code to list all files in windows platform.......

second thing...i need to store all the information abt files along with path into temporary file

The (by far) easiest way to do this is really:

int main()
{
    system("cd\\");
    system("dir /s > temp.txt");
}

and all the details are in temp.txt. :)

But if you want to do it the right way, you might want to look at FindFirst() and FindNext().

great

along with findfrst and findnext method suggested by Niek use recursion to get list of all files from harddisk

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.