On linux is there any tool can compare 2 flolders and produce a patch file?
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
开发者_Go百科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
old way: diff -uNr /opt/src /opt/dest > /tmp/src.patch
there are programs that automate the process, such as makepatch.
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.
精彩评论