Linux – Remove all .svn directories at once

When you check out a project code base from a svn repository, each downloaded directory (from top to the deepest) contains a .svn hidden directory that keeps svn’s necessary metadata.

If you want to remove them all at once, here’s one way to do it:



 ~/project_dir $> find -name .svn -print0 | xargs -0 rm -rf

find -name .svn searches the current directory hierarchy for files named .svn.

-print0 ensures each filename ended with a null character. This allows filenames that contain newlines/whitespaces to be interpreted correctly by programs that consume the output.

xargs -0 rm -rf receives the output and passes it to rm for file removal. Remember to use -0 option when the input items are terminated by a null character.

One thought on “Linux – Remove all .svn directories at once

Leave a Reply

Your email address will not be published. Required fields are marked *

*