delete a directory and its contents

In my QNX application I want to delete/remove a directory and all its contents but i cannot find a function to perform this!

I see there is rmdir(), but this only works if the directory is empty!

I also see there are two descriptions of remove() in the qnx help, one saying it deletes the file, the other saying it delete the link to a file. But i don’t think you can use this to delete a directory anyway.

Any ideas how I can do this? Also, i don’t really want to use a system call as i know I could indeed do system(“rm -rf tmp/mydir”);


You need to use opendir() to get each file one by one and delete them.

I thought that would be the answer, just seams really tedious to me!