#include <boost\filesystem\path.hpp>
#include <boost\filesystem\operations.hpp>
用boost filesytem清空(删除)文件夹下所有文件
{
boost::filesystem::path tmpPath(R"(C:\temp\test1)");
boost::filesystem::directory_iterator diter(tmpPath);
boost::filesystem::directory_iterator diter_end;
std::cout << "files:" << std::endl;
for (; diter != diter_end; ++diter) {
if (!boost::filesystem::is_regular_file(diter->status())) continue;
std::string filename = diter->path().filename().string();
std::cout << filename << std::endl;
boost::filesystem::remove(diter->path());
}
return 0;
}