tags:

views:

356

answers:

2

I want to bulk move a large number of files from one directory to another in svn. Unfortunately svn only supports moving one file at a time.

Basically I want to move files of a certain type (.xml) to a completely different directory e.g. mv foo/bar/.xml forbar/xml

I tried playing around with find and using -exec but I need to strip the directory off for the second argument. Any ideas?

EDIT: Using bash

+5  A: 

Assuming you are using bash:

for x in `find -name *.xml`; do
   echo svn move $x forbar/`basename $x`;
done

And once you are satisfied that the output is correct, remove the 'echo' from the second line.

Sean Bright
+5  A: 

You can do it with the -execdir option. This runs from the directory that the source files are in (which avoids race conditions with directory linking and etc).

find -name '*.xml' -execdir svn move {} `pwd`/foobar/{} \;
geocar
I like this: very nice.