Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <Windows.h>
- #include <fstream>
- #include <filesystem>
- using namespace std;
- void print_directory_info(const string& str) {
- for (const auto& a : filesystem::directory_iterator(str)) {
- cout << setw(30) << a.path().filename().string();
- string full_name = str + '/' + a.path().filename().string();
- if (filesystem::is_regular_file(full_name)) {
- cout << '\t' << filesystem::file_size(full_name);
- }
- cout << endl;
- }
- }
- int main() {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- print_directory_info("C:/Users/PC/Desktop");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement