void
TraverseFolder(
LPCTSTR
lpPath)
{
TCHAR
szFind[MAX_PATH] = {_T(
"\0"
)};
WIN32_FIND_DATA findFileData;
BOOL
bRet;
_tcscpy_s(szFind, MAX_PATH, lpPath);
_tcscat_s(szFind, _T(
"\\*.*"
));
HANDLE
hFind = ::FindFirstFile(szFind, &findFileData);
if
(INVALID_HANDLE_VALUE == hFind)
{
return
;
}
while
(TRUE)
{
if
(findFileData.cFileName[0] != _T(
'.'
))
{
_tprintf(_T(
"%s\\%s\n"
), lpPath, findFileData.cFileName);
if
(findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
_tcscpy_s(szFind, MAX_PATH, lpPath);
_tcscat_s(szFind, _T(
"\\"
));
_tcscat_s(szFind, findFileData.cFileName);
TraverseFolder(szFind);
}
}
bRet = ::FindNextFile(hFind, &findFileData);
if
(!bRet)
{
break
;
}
}
::FindClose(hFind);
}