Show file count in each directory, and moved "Too many files" message (#1376)

* Added file_count() function
* Show file count in each directory; moved "Too many files!" warning
This commit is contained in:
Mark Thompson 2023-08-16 03:00:46 -05:00 committed by GitHub
parent f079d57fc6
commit e1cc0b1ad0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 18 deletions

View file

@ -579,6 +579,17 @@ bool is_empty_directory(const path& file_path) {
return !((result == FR_OK) && (filinfo.fname[0] != (TCHAR)'\0'));
}
int file_count(const path& directory) {
int count{0};
for (auto& entry : std::filesystem::directory_iterator(directory, (const TCHAR*)u"*")) {
(void)entry; // avoid unused warning
++count;
}
return count;
}
space_info space(const path& p) {
DWORD free_clusters{0};
FATFS* fs;