I have an error when I try to list a simple .pdf
on my desktop.
#include <string>
#include <iostream>
#include <filesystem>
#include <vector>
using namespace std;
namespace fs = std::filesystem;
int main()
{
unsigned long int nbFile = 0;
unsigned long size = 0;
string path = R"(C:\Users\Adam\Desktop\)";
for ( const auto &entry : fs::recursive_directory_iterator((path), fs::directory_options::skip_permission_denied)) {
if (fs::is_regular_file(entry.path())){
cout << entry.path() << endl;
nbFile++;
size += entry.file_size();
}
}
cout << "Nombre de fichier : " << nbFile << "\nSize : " << size << endl;
system("pause");
return 0;
}