How to do a bulk svn mv in Unix

别说谁变了你拦得住时间么 提交于 2019-12-23 19:52:59

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!