Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <Windows.h>
- using namespace std;
- int main()
- {
- int fileCount = 0;
- string folderPath = "maps/easy/";
- // Get the first file in the folder
- WIN32_FIND_DATAA findFileData;
- HANDLE hFind = FindFirstFileA((folderPath + "*").c_str(), &findFileData);
- // Iterate through the files in the folder
- if (hFind != INVALID_HANDLE_VALUE)
- {
- while (true)
- {
- // Check if the current file is a regular file
- if ( (findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
- {
- fileCount++;
- }
- if ( !(FindNextFileA(hFind, &findFileData)) )
- {
- break;
- }
- }
- // Clean up
- FindClose(hFind);
- }
- cout << "Number of files: " << fileCount << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement