2

Possible Duplicate:
How to remove a non-empty directory in C++?

I have the directory name. i am trying remove(dir_name), but as the directory is not empty its returning false.

How can i delete the directory. Is there any built-in function which i can call??

Community
  • 1
  • 1
SPB
  • 4,040
  • 16
  • 49
  • 62
  • possible duplicate of [How to remove a non-empty directory in C++?](http://stackoverflow.com/questions/3284552/how-to-remove-a-non-empty-directory-in-c) and [How do I remove a directory that is not empty](http://stackoverflow.com/questions/1653771/how-do-i-remove-a-directory-that-is-not-empty) – Fred Larson Apr 27 '11 at 13:21

1 Answers1

6

To recursively remove a directory and all it's contents, use the following command in a terminal:

rm -rf /path/to/dir

Edit: Seems I was confused by your mention of built-in function, I was assuming a function "built into" linux. Obviously this is not C++ code. If that's what you want, see the question linked to in Fred Larson's comment to your original question.

AVH
  • 11,349
  • 4
  • 34
  • 43