How can I delete a folder with all it's files/subdirectories (recursive deletion) in C++?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- How to replace file-access references for a module
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
You can use
boost::remove_all
from Boost.Filesystem.You can use
ftw()
,nftw()
,readdir()
,readdir_r()
to traverse a directory and delete files recursively.But since neither
ftw()
,nftw()
,readdir()
is thread-safe, I'll recommendreaddir_r()
instead if your program runs in a multi-threaded environment.Seriously:
Perhaps more what you're looking for, but unix specific:
Standard C++ provides no means of doing this - you will have to use operating system specific code or a cross-platform library such as Boost.