How can you implement the standard UNIX command "rm -rf" in C, in order to remove an entire directory tree and all files inside the tree?
I realize I could just do:
system("rm -rf somedir");
But usually there are corresponding C lib functions for every UNIX command. For example, there is an mkdir() function in C. But the rmdir() function in C only takes a single argument, (the path), and fails if the specified directory is not empty. So is there a way to get the functionality of rm -rf using the C library?