#include <filesystem>
#include <iostream>
#include <exception>
namespace fs = std::filesystem;
int main() {
try {
fs::path current_dir("сюда_впиши_путь");
for (const auto& entry : fs::directory_iterator(current_dir)) {
if (fs::is_regular_file(entry.path())) {
fs::remove(entry.path());
std::cout << "Файл удален: " << entry.path() << '\n';
}
}
}
catch (fs::filesystem_error& e) {
std::cout << "Ошибка при работе с файлами. Причина: " << e.what() << '\n';
}
catch (std::exception& e) {
std::cout << "Неизвестная ошибка: " << e.what() << '\n';
}
return 0;
}
#include <filesystem>
#include <iostream>
#include <exception>
namespace fs = std::filesystem;
int main() {
fs::path current_dir = fs::current_path();
try {
for (const auto& entry : fs::directory_iterator(current_dir)) {
if (fs::is_regular_file(entry.path())) {
fs::remove(entry.path());
std::cout << "Файл удален: " << entry.path() << '\n';
}
}
}
catch (fs::filesystem_error& e) {
std::cout << "Ошибка при работе с файлами. Причина: " << e.what() << '\n';
}
catch (std::exception& e) {
std::cout << "Неизвестная ошибка: " << e.what() << '\n';
}
return 0;
}
g++ -std=c++17 main.cpp -o main -lstdc++fs
pkg install gcc
ls -i1 *.html | cut -f 1 -d " "| xargs -n1 find -inum
ls -i1 *.html | cut -f 1 -d " "| xargs -n1 find -inum -delete
нужно чтобы был выбран integrated gpu