Recursive remove directory.

What is the best way to completely remove dir with it's content ???
rmdir deletes only EMPTY dirs as i know.
The man page of remove function says "remove() deletes a name from the file system." Can it remove any dir recursively ??? :rolleyes:

You mean the best way besides recursion, chdir(2), opendir(3), and readdir(3)? That would probably be looking at the source of rm and checking how they implemented the -r switch i guess.

You can use

rm -rf directory

But be carefull . It will delete everything including subdires and file

Yes i know rm -rf , but it isn't c++ function!!!

if i'll aksed about "rm -Rf", i'll post it in "Shell Scripting" forum.
Actually, google said there is no c++ function like "rm -Rf". =(((

Recently I used the rm -Rf command and omitted a xter which accidentally removed my whole usr under /.
Now can I bring back the server?

A good start would be not spamming unrelated questions, even if the threads are old. If you've got a question, start a new thread in the appropriate forum.

How do I do that?

Admin linux: Recover from rm