Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tried to download 7z archive twice and both times it wasn't downloaded completely. So I have 2 partly downloaded 2GB files and according to downloaded segments diagram in download manager program it should be possible to join them into one completed file.
So I wonder what is the best way to do this?
Thanks in advance!

share|improve this question
How scattered are the complete parts? – Dennis Aug 3 '12 at 17:01
Like this. 1st: ++++----++++++++ , 2nd: +++++++++++---- – Sergey Metlov Aug 3 '12 at 17:12
While waiting for answer I've written a program to find a hole and now waiting for merging :) – Sergey Metlov Aug 3 '12 at 17:13
If it works out, consider posting your solution here. – Dennis Aug 3 '12 at 17:19
So you’re not asking about merging 7zip archives per se, but rather just merging two incomplete files? Assuming an NTFS drive, are they sparse files? If not, then you may indeed be able to combine them, but it depends on what is in the holes and how you are able to detect them. Years ago I wrote a program to do exactly this sort of thing, but it requires you to be be able to somehow identify which file has the correct bytes at any given position. – Synetech Aug 3 '12 at 17:26

I expected you to give me any name of program to solve the problem and while waiting for answer I created such program by myself. Simple code (C#):

static void Main(string[] args)
    int fails = 0;
    long failStart = 0;
    long failEnd = 0;

    const string fileWithHole = @"c:\Downloads\1\eveonline_395875_1of2.7z";
    const string fileFilledWhereHole = @"c:\Downloads\eveonline_395875_1of2.7z";

    // Copy of the 1st one to repair the hole:
    const string targetFile = @"d:\Eve\eveonline_395875_1of2.7z";

    using (var br = new BinaryReader(new FileStream(fileWithHole, FileMode.Open)))
        long pos = 0;
        long len = br.BaseStream.Length;

        using (var br1 = new BinaryReader(new FileStream(fileFilledWhereHole, FileMode.Open)))
            using (var w = File.OpenWrite(targetFile))
                // As I know that hole is in the 1st half of file:
                while (pos < len/2)
                    byte b = br.ReadByte();
                    byte b1 = br1.ReadByte();

                    // 1 MB to log:
                    if (pos%1000000 == 0)
                        Console.WriteLine("{0} MB", pos/1000000);
                        Console.WriteLine("FAILS: {0}", fails);
                        Console.WriteLine("FROM {0} TO {1}", failStart, failEnd);

                    if (b != b1)

                        if (failStart == 0)
                            failStart = pos;
                            w.Seek(pos, SeekOrigin.Begin);
                        failEnd = pos;

                        // Repair the hole in copied file:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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