Subversion bulk move

January 28, 2008

The version control system Subversion comes with a handy function to copy or move an already versioned file from one place in the repository to another: The command svn move.

This is particularly good (and superior over, for example, CVS which is unable to do so) because the version history of the file is kept, and also the copy on the server is done lazily, meaning just because the file was copied there won't be a second physical copy created on the server (yet, until you write to it).

A drawback of the command, though, is that it is only possible to move one single file or directory at a time. If you have a lot of files to be moved, this can get very tedious.

However, if the files you want to cover have something to be distinguished by, you may try the following (which I blog here mainly so I can get back later when I have forgotten the syntax again ;) ):

find . -name "06*" -maxdepth 1 -exec svn mv "{}" 2006/ \;

Note that I am filtering by name here (everything starting with 06), with a maximum tree depth of 1 (to avoid pulling in the .svn folder) and I am moving the respective files into the (recently created) subfolder 2006/. Also note that the the -exec flag of the find command wants to be terminated by a semicolon, but since that is a reserved character for the Bash shell, you need to escape it. This is something I trip over every time.

Anyway, I hope this helps.

Was this helpful? Buy me a coffee with Bitcoin! (What is this?)

Updating Adobe Flash Without Restarting Firefox

No reason for a Flash upgrade to shut down your entire browser, even if it claims so.It's 2015, and the love-hate relationship of the Web...… Continue reading

Reddit's Fail-Alien (or "Fail-ien?")

Published on January 15, 2015