Naf*_*Kay 5 recursive rename synchronization
我需要基本上合并两棵树上的更改,将更改从分支 2 应用到分支 1。我有这样的树:
media
??? cd
? ??? 0
? ? ??? file1
? ? ??? file2
? ? ??? file3
? ??? 1
? ? ??? file1
? ? ??? file2
? ? ??? file3
? ??? 2
? ??? file1
? ??? file2
? ??? file3
??? dvd
? ??? 0
? ? ??? file1
? ? ??? file2
? ? ??? file3
? ??? 1
? ? ??? file1
? ? ??? file2
? ? ??? file3
? ??? 2
? ??? file1
? ??? file2
? ??? file3
??? stuff
??? 0
? ??? file1
? ??? file2
? ??? file3
??? 1
? ??? file1
? ??? file2
? ??? file3
??? 2
??? file1
??? file2
??? file3
Run Code Online (Sandbox Code Playgroud)
我已经更改了分支 2 中的文件,我需要将它们应用到分支 1。如果我只是尝试将它们移到分支 1 上,则会出现以下错误:
mv: cannot move `/branch2/media/cd' to `/branch1/media/cd': Directory not empty.
Run Code Online (Sandbox Code Playgroud)
我应该为此使用另一个命令吗?mv -f
似乎没有办法。
为什么不rsync
改用?
rsync -a /branch2/media/ /branch1/media/
Run Code Online (Sandbox Code Playgroud)
之所以mv
不能移动/branch2/media/cd/
,/branch1/media
是因为里面/branch1/media
已经有了cd/
。 mv
拒绝破坏非空目录。