CString ClatestfoldernameDlg::FindLatestFolder(CString path) { CString Folder; CString LatestFolder = _T("D:\\xyz"); FILETIME newtime,oldtime; WIN32_FIND_DATA ffd; HANDLE hFind = INVALID_HANDLE_VALUE; CString strWildcard(path); strWildcard += _T("\\*"); // Find the first file in the directory. hFind = FindFirstFile(strWildcard, &ffd); FindNextFile(hFind, &ffd); FindNextFile(hFind, &ffd); //AfxMessageBox(ffd.cFileName); oldtime=ffd.ftLastWriteTime; do { if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { newtime = ffd.ftLastWriteTime; Folder = ffd.cFileName; if(CompareFileTime(&newtime,&oldtime)==1) { LatestFolder=Folder; } oldtime = newtime; } } while (FindNextFile(hFind, &ffd) != 0); return LatestFolder; }
LatestFolder
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)