I would like to relocate multiple checked out SVN directories on my local machine, since our SVN server moved and now has a different IP address. Instead of doing this through a tool like SmartSVN or TortoiseSVN, I would like to use a script to do the directories in one sweep.
Each directory contains a different working copy – so either a different project or sometimes also a different branch or tag, therefore I can’t just do the relocate in the root directory.
I found a partial solution on a web page that has disappeared, and also an improved version in the comments, but I wanted to clean it up a bit and provide it here for other people as well
The IP addresses are fictional and need to be adjusted to local settings.
The script iterates over all directories that are managed by SVN and use the old location, then calls the
svn switchcommand with the relocate option for each one.If you also want to change the user while relocating, it’s easy to add something like
--username $USERNAMEparameter to the command, and defining the$USERNAMEat the top of the script.