求C++程序,删除程序当前目录下的所有空文件夹(包括文件夹里的文件夹)
求C++程序,删除程序当前目录下的所有空文件夹(包括文件夹里的空文件夹)
[解决办法]
#include <boost/filesystem/operations.hpp>
int main(int argc, char** argv)
{
if ( argc != 2 ) return EXIT_FAILURE;
boost::filesystem::path path_( argv[1] ); // define path of file or directory;
int removed = boost::filesystem::remove_all( path_ );// remove entire directory;
return EXIT_SUCCESS;
}