问题
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
回答1:
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/{} \;
回答2:
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.
来源:https://stackoverflow.com/questions/581546/how-to-do-a-bulk-svn-mv-in-unix