Return to Snippet

Revision: 21874
at December 22, 2009 15:36 by magicrebirth


Initial Code
# This searches recursively for all directories (-type d) in the hierarchy starting at "." (current directory), and finds those whose name is '.svn'; the list of the found directories is then fed to rm -rf for removal.

find . -name '.svn' -type d | xargs rm -rf

# If you want to try it out, try

find . -name '.svn' -type d | xargs echo

# This should provide you with a list of all the directories which would be recursively deleted.

==================================

# Another way is: 

find . -name ".svn" -exec rm -rf {} \;

#Try something like this first to do a dry run:

find . -name ".svn" -exec echo {} \;

#Note that the empty braces get filled in with the file names and the escaped semicolon ends the command that is executed (starting after the "-exec").

Initial URL

                                

Initial Description

                                

Initial Title
Command line delete matching files and directories recursively

Initial Tags
unix, find

Initial Language
Bash