home *** CD-ROM | disk | FTP | other *** search
- // =========================================================
- // FILEFIND.CPP
- // FileFind-Routine
- // =========================================================
-
- #include <dos.h>
- #include <stdio.h>
- #include <direct.h>
-
- void FindFile(const char * pszFileName );
- void main(void)
- {
- FindFile( "*.*" );
- }
-
- void FindFile(const char * pszFileName)
- {
- struct find_t aFile;
- int fDone;
- fDone = _dos_findfirst(pszFileName, 0xffff, &aFile);
- while (! fDone)
- {
- if (((aFile.attrib&_A_SUBDIR) != _A_SUBDIR) &&
- (aFile.name[0] != '.') &&
- ((aFile.attrib&_A_VOLID) != _A_VOLID))
- {
- printf("%s\n", aFile.name );
- }
- fDone = _dos_findnext(&aFile);
- }
- fDone = _dos_findfirst("*", _A_SUBDIR |
- _A_SYSTEM | _A_HIDDEN, &aFile);
- while (! fDone)
- {
- if (((aFile.attrib&_A_SUBDIR) == _A_SUBDIR) &&
- (aFile.name[0] != '.'))
- {
- printf("sub:%s\n", aFile.name);
- chdir(aFile.name);
- FindFile(pszFileName);
- chdir("..");
- }
- fDone = _dos_findnext(&aFile);
- }
- }