Wednesday, January 27, 2010

Find and remove directory in Linux

Cheeky notes to begin 2010,

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

- interpret the above command as, “find all items in the current (.) directory of type directory (-type d) matching the name “.svn” and pipe the output to the exec “rm” command.

Removes all the folder named “.svn” from given directory and all subdirectory and deletes recursively.


dEEPS said...

Some commands don't deserve to be run piped.. rm -rf is one such.

For obvious reasons :)