在linux上有没有什么工具可以比较2个文件夹并生成补丁文件?

发布于 2024-10-05 09:15:41 字数 297 浏览 0 评论 0原文

/opt/src 目录下的 A,B,C 文件

D,E,/opt/dest 目录下的 A 文件

比较 src 和 dest,找出应该将 B,C 添加到 dest 并删除 D,E,看看 A 是否改变

并给 A 一个二进制补丁或者只是覆盖它。

所有这些操作都打包在一个补丁文件中,包括更改的和丢失的文件内容,我可以将此文件复制到另一台机器上执行。

我知道编写一些程序来做到这一点很简单,但我不想再次发明轮子

rsync 似乎满足了我的大部分需求,但不知道如何制作补丁。

谢谢

A,B,C file in directory /opt/src

D,E,A file in dircory /opt/dest

compare src and dest, figure out should add B,C to dest and delete D,E, and see if A is changed

and give A a binary patch or just to overwrite it.

all this operation pack in a patch file,including the changed and the missed file content, I can copy this file to another machine to execute.

I know it's simple to write some program to do this, but I don't want invent the wheel again

rsync seems meet most of my needs but don't know how to make a patch.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌路黄昏 2024-10-12 09:15:41

旧方法: diff -uNr /opt/src /opt/dest > /tmp/src.patch

有一些程序可以自动执行该过程,例如 makepatch。

old way: diff -uNr /opt/src /opt/dest > /tmp/src.patch

there are programs that automate the process, such as makepatch.

予囚 2024-10-12 09:15:41

带有选项 -r 的程序 diff

diff [-c| -e| -f| -C n][-br] file1 file2

[...]

-r
  Apply diff recursively to files and directories
  of the same name when file1 and file2 are both
  directories.

The program diff with the option -r

diff [-c| -e| -f| -C n][-br] file1 file2

[...]

-r
  Apply diff recursively to files and directories
  of the same name when file1 and file2 are both
  directories.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文