In C ++, how can I remove a directory with all its contained files? I know that rmdir is, but it will only remove empty-free directories, so how do I list and delete all the files first?
I know that it should not be difficult to use the Boost filesystem, but I want to avoid building a small work like this and on this basis I want to do it ... < / P>
Yes, you have to first remove the content first if you do not want to use Boost for this, You can search non-portable files for all files (e.g., FindFirstFile , FindNextFile ) Do not disturb too much with Windows OS, opendir , readdir on UNIX and similarly) recursively, and delete all of them.
Comments
Post a Comment