在linux上有没有什么工具可以比较2个文件夹并生成补丁文件?
/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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
旧方法: 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.
带有选项 -r 的程序
diff
The program
diff
with the option -r