Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否有任何智能方法可以使用SVN命令重命名终端上的多个文件?_Svn_Terminal_File Rename - Fatal编程技术网

是否有任何智能方法可以使用SVN命令重命名终端上的多个文件?

是否有任何智能方法可以使用SVN命令重命名终端上的多个文件?,svn,terminal,file-rename,Svn,Terminal,File Rename,我有许多文件要移动和重命名,它们在SVN下。命名规则如下 current path: /root/parent/child_01.html new path: /root/parent/child/article_01.html 我知道我可以用“svnmove”命令重命名,但我有大约50个文件要用序列号重命名 我找到了这个。这与我的问题非常相似,但我希望使用SVN下的文件进行此操作。基本模式与以下问题的答案相同: 查找所有文件 工艺指挥部 执行命令 对于您的具体情况,这将类似于: fi

我有许多文件要移动和重命名,它们在SVN下。命名规则如下

current path: /root/parent/child_01.html
new path:     /root/parent/child/article_01.html
我知道我可以用“svnmove”命令重命名,但我有大约50个文件要用序列号重命名


我找到了这个。这与我的问题非常相似,但我希望使用SVN下的文件进行此操作。

基本模式与以下问题的答案相同:

  • 查找所有文件
  • 工艺指挥部
  • 执行命令
  • 对于您的具体情况,这将类似于:

    find /tmp -regex ".*_\d+\.html$" -regextype posix-extended -type f -print0 | # find all html files with a number in the name
    gawk 'BEGIN{ f = gensub(/(.*)(_\d+\.html)/, "\\1/article\\2", "g"); printf "svn mv %s %s\n", $0, f}' | # build svn command
    bash # run command
    

    NB:作为一般警告,首先通过回显而不是执行来测试这样的脚本。我没有测试这个,因为我手头没有shell。

    使用了哪个操作系统(即命令解释器)?所以一般的命名规则是
    s{(\w*)\ud*)\.html}{$1/article\u$2.html}
    ?我使用Mac OS 10.8.5。非常感谢你回答我的问题!现在尝试将其“翻译”为cmd。exe@LazyBadger这是留给读者的练习。正斜杠表示类似Unix的环境。另外,“非常相似”的链接问题使用了bash。但是cmd应该是可行的。没有发现就不容易,也不一定容易。