This script works fine, however, it only scans the directory specified, but not it's sub directorys. How can I get it to do that?
Thanks, August.Code:void FindFileExample () { WIN32_FIND_DATA FileData; // Data structure describes the file found HANDLE hSearch; // Search handle returned by FindFirstFile TCHAR szSearchPath[] = TEXT("A:\\Sum_2\\"); BOOL bFinished = FALSE; // Create a new directory. if (!CreateDirectory (szDirPath, NULL)) { Error(TEXT("Unable to create new directory.")); return; } // Start searching for .txt files in the root directory. hSearch = FindFirstFile (szSearchPath), &FileData); if (hSearch == INVALID_HANDLE_VALUE) { Error(TEXT("No .TXT files found.")); return; } // Copy each .txt file to the new directory and change it to // read-only, if it is not already read-only. while (!bFinished) { AddStringToData(FileData.cFileName); if (!FindNextFile (hSearch, &FileData)) { bFinished = TRUE; if (GetLastError () == ERROR_NO_MORE_FILES) { Error(TEXT("Found all of the files.")); } else { Error(TEXT("Unable to find next file.")); } } } // Close the search handle. if (!FindClose (hSearch)) { Error(TEXT("Unable to close search handle.")); } }
btw: I have the functions Error() and AddStringToData() allready declared.



LinkBack URL
About LinkBacks


