Bash: Remove all .svn folders - Un-checkout from svn

If you want to send somebody parts of your svn repository, then you mostly do not want to give them your .svn folders with all the settings and base files inside.

I wrote a short command to remove all the .svn folders recursive from the current directory:

for dir in $(find . -name ".svn" -type d); do rm -rf "$dir"; done

find . -name ".svn" -type d
- Will list recursive all directorys named '.svn' in current directory.

for dir in $(...); do rm -rf "$dir"; done
- Will delete all items from the result of $().

If you do not want to type and remember that much, you can easily add this as a bash alias.
Open your .bashrc and add this line:

alias unsvn='for dir in $(find . -name ".svn" -type d); do rm -rf "$dir"; done'

The next time you start a bash, you have a new command "unsvn".

Related posts:


Die Kommentarfunktion zu diesem Beitrag wurde deaktiviert.