Let's say I have two folders: before and after.



The bash in the before folder differs from the bash in after.

Using bsdiff or a similar program, is there a way to create a binary patch between the two folders? The program does not have to support Windows. New files in the after directory need to be included with the patch file as well.

The reason I don't want to package after as a whole is to minimize the size of the patch.

  • What is your goal in making a patch rather than simply taring up after? Just minimizing the size, or do you also expect something sensible to happen if the patch is applied to a directory tree that is slightly different from before? Apart from file names and contents, do you need to preserve metadata (timestamps, ownership, etc.)? – Gilles 'SO- stop being evil' Jun 14 '16 at 21:37
  • I want to minimize the size of my patch for convenience. And no, I don't need to preserve timestamps and ownership. – Spotlight Jun 14 '16 at 21:40

The xdelta program does exactly what you are looking for:

Name : xdelta

Description : Xdelta (X for XCF: the eXperimental Computing Facility at Berkeley) is a binary delta generator (like a diff program for binaries) and an RCS version control replacement library. Xdelta uses a binary file delta algorithm to replace the standard diff program used by RCS

  • It appears this doesn't support folders, though there seems to be some type of perl script that accomplishes this task. – Spotlight Jun 14 '16 at 20:48
  • That program worked exactly as I wanted it to, and it helped me even further with the xdelta3-dir-patcher wrapper program. – Spotlight Jun 15 '16 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.