-5

I want to write a little program which lists all the files in the computer and then outputs their paths.

For example:

Jhon.txt => D:/Smth/Smth/Jhon.txt
Mom.txt => D:/Smth/Mom.txt
Dad.exe => C:/Dad.exe

And so on.

So I want to ask what would be best way to do this?

Thanks.

tux3
  • 7,171
  • 6
  • 39
  • 51
Glimber
  • 19
  • 3

1 Answers1

1

In ubuntu 12.04, I used the "#include dirent.h" interface to access functions (like opendir(), closedir(), readdir() etc.) and constants for this effort.

With these, my program can read dirs and pfns starting at a directory. (But you don't want to start at dir "/", and there are several dir's you should skip.)

At a terminal, try man opendir.

I have only used this on Linux (specifically ubuntu 12.04 and a few earlier versions of ubuntu.)

"dirent.h" does fairly well on NTFS, but NTFS has some interesting kludges I no longer wish to work on.

Good luck.

2785528
  • 5,438
  • 2
  • 18
  • 20