The rm command deletes files. To delete a directory that is not empty and its subdirectories, use$ rm -rf directory

However, sometimes you need to remove a specific subdirectory rather than the entire directory and its contents. For example:

|-- engine
|-- mod
    |-- .svn
    |-- anytext
    |    |-- .svn
    |    |-- actions
    |-- crontrigger
    |    |-- .svn
    |    |-- views

We want to delete all .git directories and nothing else. We could manually do rm-r .git for every .git directory but there is an easier and more elegant way:

$ rm -rf `find . -type d -name .git`

find will find all directories names .git and rm  would delete them and their contents.