How to clean .svn directories from subversion working copy?

Tags:  •    •    •  

The well known way is svn export. Some times this command is not applicable. You can use this simple shell command in this case (Linux/*nix only).

find destination/directory_name/ -name .svn -type d | xargs -n 1 rm -rf

You need to change destination/directory_name/ to your real path, what you want clean.

Or here is a simple bash script. Use this for

#!/bin/bash
if [ -z $1 ]
then
   echo "Usage: $0 <directory_path>"
   echo "Where <directory_path> is the path what you want clean."
   exit
fi
 
find $1 -name .svn -type d | xargs -n 1 rm -rf

Copy and paste this script to a file at your /usr/local/bin/. (For example: svn-cleaner.sh)

You make it executable: chmod +x /usr/local/bin/svn-cleaner.sh

Now you can run svn cleaner script as svn-cleaner.sh and all .svn directory will delete.

Please leave a comment below!

Post new comment

The content of this field is kept private and will not be shown publicly.