Welcome to the adventure

Moving multiple files in subversion

Sunday September 17, 2006

Ever tried moving many files with svn? You can conveniently do this:

svn remove *.cs

but vexingly you cannot do this:

svn move *.cs newFolder/

So memorize this oft-used iteration idiom (bash):


for i in *.cs ; do svn mv $i newFolder/ ; done

Which will move all *.cs files (or whatever shell-expansion expression you use) to newFolder/

7 Comments »

  1. […] I followed this article: Moving multiple files in subversion and this almost worked, but I had problem with the Xcode project file (.xcodeproj) and some NIBs. The problem was that the .xcodeproj “file” is really a Package (or directory) and contains multiple files, some of which were not properly version controlled. I don’t know exactly what happened, but in the end, SVN was expecting the .xcodeproj file to be at “myProj”, my local SVN client had it at myProj/trunk and ’svn status’ showed an ‘S’ in the 5th column which I could not resolve for the life of me! Good thing I had a hotcopy. A hotcopy creates a fully functional copy of your repository, able to be dropped in as a replacement. […]

    Pingback by blog » Did you forget your SVN trunk for your Xcode project? March 28, 2007 at about 4:14 pm

  2. […] I followed this article: Moving multiple files in subversion and this almost worked, but I had problem with the Xcode project file (.xcodeproj) and some NIBs. The problem was that the .xcodeproj “file” is really a Package (or directory) and contains multiple files, some of which were not properly version controlled. I don’t know exactly what happened, but in the end, SVN was expecting the .xcodeproj file to be at “myProj”, my local SVN client had it at myProj/trunk and ’svn status’ showed an ‘S’ in the 5th column which I could not resolve for the life of me! Good thing I had a hotcopy. A hotcopy creates a fully functional copy of your repository, able to be dropped in as a replacement. […]

    Pingback by ryanhomer.com » Adding an SVN trunk after the fact May 4, 2007 at about 10:26 am

  3. […] Moving multiple files in Subversion […]

    Pingback by Reading list - 15 Jun 07 « Ĕphēmĕris Fictrīcis June 15, 2007 at about 2:24 am

  4. That is awesome! Man I need to learn bash scripting soon!

    Thanks for sharing.

    Said by Peter October 16, 2007 at about 4:39 pm

  5. Snazzy!

    Said by Dan November 14, 2007 at about 1:44 pm

  6. Can i also rename multiple files this way?

    i need to rename all my *.en-US.resx files to just *.en.resx

    Said by Dennis Jakobsen February 7, 2008 at about 9:56 am

  7. Excellent tip - thanks very much saved me alot of trouble.
    I made it into a more general shell script (svnMove) by doing:

    for i in *.$1 ; do
    svn mv $i $2
    #echo $i
    done

    Then you can go:

    svnMove cs newFolder/

    Said by Paul M March 2, 2008 at about 8:02 pm

Leave a comment