This is an MFC class that enables you to recursively search directories for files and other directories. It may not be the most efficient class in the world, but it does what it it supposed to do.

Download 1,259 Byte


Using CRecFileFind is easy. First create an object and provide the path to the directory you want to search:

CRecFileFind finder ("c:\\temp");

Now let's see what has been found:

int nF = finder.GetFileCount();
int nD = finder.GetDirCount();

for (int i=0; i<nF; i++)
   CString file = finder.GetFile(i);
   // Do something with the file

for (i=0; i<nD; i++)
   CString dir = finder.GetDir(i);
   // Do something with the directory

Simple enough? CRecFileFind is freeware, use it whichever way you like. But send me a note if you use it, or if you find any bugs.