I wrote a new tool: zeromerge

This program merges two files together that are the same size but with missing blocks of data (currently processed at 4K granularity) represented by all zeroes. This is particularly useful for old torrents that aren't fully seeded. In many cases, several different torrents exist for an identical file or file set, possibly with different extra files (garbage text files saying where it was downloaded from, for example) or a different torrent chunk size. It is very sad to have two torrents in the pipeline and see that the missing data chunks in one can be filled in with successful chunks from the other and vice-versa, possibly creating a complete or near-complete file. However, I found no tool existed for this purpose.

Thus, zeromerge was born! Feed it two file paths and an output file path and it'll combine the two files into one unified file. You can then copy the unified file over both of the originals and perform a torrent re-check to make the new progress visible and start cross-seeding those newly merged chunks of data to others. Files must be the exact same size and any present data which is not identical will cause zeromerge to abort.

Since writing this tool, I have used this successfully in two different cases to merge two pairs of files with missing data into one complete file and one file with only one piece missing instead of several.

https://github.com/jbruchon/zeromerge