How to remove folders with a certain name

The Solution to How to remove folders with a certain name is


If the target directory is empty, use find, filter with only directories, filter by name, execute rmdir:

find . -type d -name a -exec rmdir {} \;

If you want to recursively delete its contents, replace -exec rmdir {} \; with -delete or -prune -exec rm -rf {} \;. Other answers include details about these versions, credit them too.

~ Answered on 2012-10-23 14:29:25


Most Viewed Questions: