In Ubuntu how do I delete a directory and everything underneath it?

6

1

In Ubuntu how do I delete a directory and everything underneath it, including directories and their contents?

Yazz.com

Posted 2010-02-16T15:37:47.823

Reputation: 2 813

Answers

15

What you are describing is called a recursive remove. To do this, open a shell and type:

rm -r /path/to/directory

eleven81

Posted 2010-02-16T15:37:47.823

Reputation: 12 423

brilliant. worked first time! – Yazz.com – 2010-02-16T15:40:38.270

1...and don't run this as root unless you really need to, and if you do, be very careful, especially if you add the '-f' option. – Bryan – 2010-02-16T16:52:47.127

4

cd parent-directory_of_folder_to_be_blasted
rm -r the_folder_that_needs_to_be_blasted

Nicholaz

Posted 2010-02-16T15:37:47.823

Reputation: 1 479

3

rmdir: The rmdir command will delete an empty directory. To delete a directory and all of its contents recursively, use rm -r instead.

r0ca

Posted 2010-02-16T15:37:47.823

Reputation: 5 474