On Windows OS, we can use right-click on a folder, and it will show property information which will contain folder size information. Now, I want to use Windows API to get a folder size, I do not want to use FindFirstFile/FindNextFile to enumerate all files. Thanks in advance.
I tried below code, however, it returns size with an invalid data.
HANDLE hFile = CreateFile(tsFolderPath.c_str(), GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS, NULL);
LARGE_INTEGER fileSize;
GetFileSizeEx(hFile, &fileSize);
CloseHandle(hFile);