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.

Read more…