How do you delete a folder and all contents in Terminal?
Sometimes I run across a folder that I want to delete, but the items inside are locked or owned by root so I can't delete them unless I use the terminal. I manage to finish eventually, but I have to sudo rm everything individually, then sudo rmdir all the empty folders. Is there anyway to delete one folder and all of the contents?
Comments
[ 03-09-2003: Message edited by: MCQ ]</p>
<strong>Taking a glance at the man pages, I'm guessing "sudo rm -r" would do the trick?
[ 03-09-2003: Message edited by: MCQ ]</strong><hr></blockquote>
Ah, my favorite command...
You should be very careful with that, I don't reccomend doing it at the root level of your drive, unless you don't like you data.
>man rm
<strong>
Ah, my favorite command...
You should be very careful with that, I don't reccomend doing it at the root level of your drive, unless you don't like you data. </strong><hr></blockquote>
At least rm -r prompts you for each file it intends to delete.
rm -rf is the spawn of the devil.
That will do it.
-d for directory
-R for recursive.
<strong>lol, so is that the correct command? Or is there some safer command that does the same thing?</strong><hr></blockquote>
Well if you would READ THE MAN PAGE you could see what all the options do.