my_app; curl http://127.0.0.1:12345/process_closed.php
cmd /c my_app & curl http://127.0.0.1:12345/process_closed.php
#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
если ntfs то у тебя должен быть пакет утилит ntfs-3g