Linux Rm A Folder And Contents

by on November 19, 2007 · 1 comment· LAST UPDATED May 23, 2010

in , ,

How do I remove a folder and all its contents including files and other folders?

You need to use the rm command. Use the -r option to remove the listed directories and their contents recursively. The syntax is:

 
rm -rf dirName
 

In this example, remove data directory and their contents recursively, enter:

 
rm -rf data
 

See also:

See the rm command man page for more information:
man rm



If you would like to be kept up to date with our posts, you can follow us on Twitter, Facebook, Google+, or even by subscribing to our RSS Feed.


{ 1 comment… read it below or add one }

1 Philippe Petrinko May 18, 2010 at 12:48 pm

Typos here:
“m” instead of “rm” ! ;-)

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , ,

Previous Faq:

Next Faq: